提交 9475972b 编写于 作者: Y Yu Yang

Merge branch 'feature/backward' of github.com:reyoung/Paddle into feature/backward

......@@ -113,18 +113,16 @@ static void DeDuplicate(NetOp* net, std::unordered_se)
std::string prefix = grad_input.substr(
0, grad_input.size() - OperatorBase::GRAD_VAR_SUFFIX().size());
grad_input = prefix + OperatorBase::ZERO_VAR_SUFFIX();
std::vector<std::string> fill_zeros_in = {prefix};
std::vector<std::string> 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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册