未验证 提交 e838a4b4 编写于 作者: Y Yuang Liu 提交者: GitHub

skip CopyOrAdd when tmp grad is None (#55679)

上级 2ade1f92
...@@ -124,7 +124,10 @@ GradNodeAccumulation::operator()( ...@@ -124,7 +124,10 @@ GradNodeAccumulation::operator()(
if (!weak_grad_.expired() && !is_new_grad) { if (!weak_grad_.expired() && !is_new_grad) {
auto grad = weak_grad_.lock(); auto grad = weak_grad_.lock();
CopyOrAddTensor(grad.get(), grad_out, is_fake_empty_); if (grad_out.defined() && grad_out.initialized()) {
CopyOrAddTensor(grad.get(), grad_out, is_fake_empty_);
}
// else { do nothing since there is no valid value in grad out tensor }
is_fake_empty_ = false; is_fake_empty_ = false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册