diff --git a/paddle/framework/backward.cc b/paddle/framework/backward.cc index 1531cb53f9dc7ace9911a231e928e869cd7eca28..db4af8c7120236923f9010702fddcc7b01f68c5c 100644 --- a/paddle/framework/backward.cc +++ b/paddle/framework/backward.cc @@ -78,18 +78,16 @@ static std::shared_ptr BackwardImpl( std::string prefix = grad_input.substr( 0, grad_input.size() - OperatorBase::GRAD_VAR_SUFFIX().size()); grad_input = prefix + OperatorBase::ZERO_VAR_SUFFIX(); - std::vector fill_zeros_in = {prefix}; - std::vector fill_zeros_out = {grad_input}; - net.AddOp(OpRegistry::CreateOp("fill_zeros_like", fill_zeros_in, - fill_zeros_out, AttributeMap())); + net->AddOp(OpRegistry::CreateOp("fill_zeros_like", {prefix}, + {grad_input}, {})); } } - for (std::string& grad_output : grad_op->output_) { + for (std::string& grad_output : grad_op->outputs_) { if (no_grad_names.count(grad_output)) { grad_output = OperatorBase::EMPTY_VAR_NAME(); } } - net.AddOp(grad_op); + net->AddOp(grad_op); } net->CompleteAddOp();