diff --git a/paddle/fluid/eager/to_static/run_program_op_node.h b/paddle/fluid/eager/to_static/run_program_op_node.h index 3b14651e0c775..c243f2c7b04d8 100644 --- a/paddle/fluid/eager/to_static/run_program_op_node.h +++ b/paddle/fluid/eager/to_static/run_program_op_node.h @@ -408,6 +408,7 @@ inline void RunProgramAPI( backward_global_block, output_names, x, + input_names, params, place); interpreter_core = diff --git a/paddle/fluid/framework/executor_cache.cc b/paddle/fluid/framework/executor_cache.cc index 3f750d961bfbb..4098dcf98ac08 100644 --- a/paddle/fluid/framework/executor_cache.cc +++ b/paddle/fluid/framework/executor_cache.cc @@ -358,6 +358,7 @@ std::unique_ptr<::pir::Program> ConstructFowardIrProgram( const paddle::framework::BlockDesc *backward_global_block, const std::vector output_names, const std::vector &x, + const std::vector &x_names, const std::vector ¶ms, const phi::Place &place) { auto ir_ctx = ::pir::IrContext::Instance(); @@ -378,8 +379,9 @@ std::unique_ptr<::pir::Program> ConstructFowardIrProgram( // add data op to program auto *block = local_program.MutableBlock(0); - for (auto &in_t : x) { - auto name = in_t.name(); + for (size_t i = 0; i < x.size(); ++i) { + auto &name = x_names[i]; + auto &in_t = x[i]; if (block->FindVarRecursive(name) == nullptr) { continue; } diff --git a/paddle/fluid/framework/executor_cache.h b/paddle/fluid/framework/executor_cache.h index 9fadcab929fd4..b05b2c639af0f 100644 --- a/paddle/fluid/framework/executor_cache.h +++ b/paddle/fluid/framework/executor_cache.h @@ -255,6 +255,7 @@ std::unique_ptr<::pir::Program> ConstructFowardIrProgram( const paddle::framework::BlockDesc* backward_global_block, const std::vector output_names, const std::vector& x, + const std::vector& x_names, const std::vector& params, const phi::Place& place);