未验证 提交 70b7c7ed 编写于 作者: W Weilong Wu 提交者: GitHub

Removed unnecessary ENFORCE statement (#37219)

上级 79b49c20
...@@ -403,9 +403,6 @@ void VarBase::_CopyGradientFrom(const VarBase& src) { ...@@ -403,9 +403,6 @@ void VarBase::_CopyGradientFrom(const VarBase& src) {
platform::errors::InvalidArgument( platform::errors::InvalidArgument(
"tensor has not been initialized", src.Name())); "tensor has not been initialized", src.Name()));
auto* grad_t = grad_var_->MutableVar()->GetMutable<framework::LoDTensor>(); auto* grad_t = grad_var_->MutableVar()->GetMutable<framework::LoDTensor>();
PADDLE_ENFORCE_EQ(grad_t->IsInitialized(), true,
platform::errors::InvalidArgument(
"tensor %s has not been initialized", Name()));
auto* var_ = MutableVar()->GetMutable<framework::LoDTensor>(); auto* var_ = MutableVar()->GetMutable<framework::LoDTensor>();
grad_t->ShareDataWith(src_tensor); grad_t->ShareDataWith(src_tensor);
grad_t->Resize(var_->dims()); grad_t->Resize(var_->dims());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册