We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ade1f9 commit e838a4bCopy full SHA for e838a4b
1 file changed
paddle/fluid/eager/accumulation/accumulation_node.cc
@@ -124,7 +124,10 @@ GradNodeAccumulation::operator()(
124
125
if (!weak_grad_.expired() && !is_new_grad) {
126
auto grad = weak_grad_.lock();
127
- CopyOrAddTensor(grad.get(), grad_out, is_fake_empty_);
+ if (grad_out.defined() && grad_out.initialized()) {
128
+ CopyOrAddTensor(grad.get(), grad_out, is_fake_empty_);
129
+ }
130
+ // else { do nothing since there is no valid value in grad out tensor }
131
is_fake_empty_ = false;
132
}
133
0 commit comments