提交 065804d3 编写于 作者: Z zhongpu 提交者: hong

fix bug in grad_op compute for dygraph, test=develop (#20975)

上级 3b96e3d2
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
namespace paddle { namespace paddle {
namespace imperative { namespace imperative {
struct OpBaseCmp {
bool operator()(OpBase* first, OpBase* second) {
return first->id() > second->id();
}
};
static std::vector<std::unique_ptr<OpBase>> CreateGradOpBases( static std::vector<std::unique_ptr<OpBase>> CreateGradOpBases(
const OpBase* fw_op_base, const NameVarBaseMap& in, const OpBase* fw_op_base, const NameVarBaseMap& in,
const NameVarBaseMap& out) { const NameVarBaseMap& out) {
...@@ -130,7 +124,7 @@ void Tracer::TraceBackward(const std::shared_ptr<OpBase>& fwd_op, ...@@ -130,7 +124,7 @@ void Tracer::TraceBackward(const std::shared_ptr<OpBase>& fwd_op,
} }
} }
std::set<OpBase*, OpBaseCmp> visited_preceding_ops; std::set<OpBase*> visited_preceding_ops;
for (auto& grad_out_it : grad_out) { for (auto& grad_out_it : grad_out) {
bool flag_clear_list = false; bool flag_clear_list = false;
for (auto& var_base_it : grad_out_it.second) { for (auto& var_base_it : grad_out_it.second) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册