diff --git a/paddle/fluid/eager/tensor_wrapper.h b/paddle/fluid/eager/tensor_wrapper.h index 6405191244505b110a475d2ab4f43d72d4636074..67cd943f33174a95b04c70c33d5f9cc093581862 100644 --- a/paddle/fluid/eager/tensor_wrapper.h +++ b/paddle/fluid/eager/tensor_wrapper.h @@ -74,7 +74,7 @@ class TensorWrapper { } else { #ifndef PADDLE_NO_PYTHON if (SavedTensorsHooks::GetInstance().IsEnable() && - tensor.is_dense_tensor()) { + tensor.is_dense_tensor() && tensor.initialized()) { phi::DenseTensor* dense_tensor = static_cast(tensor.impl().get()); intermidiate_tensor_.set_impl(