From d05ec503465cd666be60526fe4dd4833ec68c815 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Tue, 8 Aug 2023 11:42:20 +0800 Subject: [PATCH] [NewIR]fix new ir sgd op bug (#55982) * fix new ir sgd op bug * fix bug * fix bug * update * revert code --- paddle/fluid/framework/executor_cache.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/framework/executor_cache.cc b/paddle/fluid/framework/executor_cache.cc index 3c351ca39c5..4d39c1a533d 100644 --- a/paddle/fluid/framework/executor_cache.cc +++ b/paddle/fluid/framework/executor_cache.cc @@ -386,6 +386,7 @@ std::unique_ptr<::ir::Program> ConstructFowardIrProgram( op_desc->SetOutput("out", {name}); } + std::set input_param_names; for (auto ¶m : params) { auto &name = param.name(); auto place = param.place().GetType(); @@ -398,6 +399,8 @@ std::unique_ptr<::ir::Program> ConstructFowardIrProgram( op_desc->SetAttr("place", static_cast(place)); op_desc->SetAttr("name", name); op_desc->SetOutput("out", {name}); + + input_param_names.insert(name); } std::set set_parameter_names; @@ -419,6 +422,10 @@ std::unique_ptr<::ir::Program> ConstructFowardIrProgram( continue; } + if (input_param_names.count(name)) { + continue; + } + auto op_desc = local_program.MutableBlock(0)->AppendOp(); op_desc->SetType("shadow_output"); op_desc->SetAttr("name", name); -- GitLab