diff --git a/paddle/framework/backward.cc b/paddle/framework/backward.cc index 1fddad8d16f9db09eaaba40229847e74ea028a8d..ab91e422eeae62070cef34d2d1279c65a4de12c0 100644 --- a/paddle/framework/backward.cc +++ b/paddle/framework/backward.cc @@ -79,9 +79,9 @@ std::shared_ptr BackwardRecursive( // All output gradients of forwarding operator do not need to calculate. // Then all input gradients cannot be computed at all, and we put them into // `no_grad_names` set. Return an NOP. - if (AllInSet(forwardOp.Output() /*names*/, kGradVarSuffix /*suffix*/, + if (AllInSet(forwardOp.Outputs() /*names*/, kGradVarSuffix /*suffix*/, no_grad_names /*set*/)) { - ForEachVarName(forwardOp.inputs_, + ForEachVarName(forwardOp.Inputs(), [&no_grad_names](const std::string& name) -> bool { no_grad_names.insert(GradVarName(name)); return false;