From 04709310379187be651dce51bd0c4028f379278c Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Fri, 18 Nov 2022 21:05:27 +0800 Subject: [PATCH] refine save hook (#48124) --- paddle/fluid/eager/tensor_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/fluid/eager/tensor_wrapper.h b/paddle/fluid/eager/tensor_wrapper.h index 6405191244..67cd943f33 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( -- GitLab