diff --git a/paddle/fluid/imperative/layer.cc b/paddle/fluid/imperative/layer.cc index 7c0b9d0782359c9ac53a76f1cec2c7b9bd194e7d..24787c4ce338ec787dee73858d4c8bcb5de7298f 100644 --- a/paddle/fluid/imperative/layer.cc +++ b/paddle/fluid/imperative/layer.cc @@ -403,9 +403,6 @@ void VarBase::_CopyGradientFrom(const VarBase& src) { platform::errors::InvalidArgument( "tensor has not been initialized", src.Name())); auto* grad_t = grad_var_->MutableVar()->GetMutable(); - PADDLE_ENFORCE_EQ(grad_t->IsInitialized(), true, - platform::errors::InvalidArgument( - "tensor %s has not been initialized", Name())); auto* var_ = MutableVar()->GetMutable(); grad_t->ShareDataWith(src_tensor); grad_t->Resize(var_->dims());