From 91040569231f50494bd461a06ab372a838ce0fd6 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Mon, 31 Jul 2023 10:25:08 +0800 Subject: [PATCH] fix new ir program translator shaddow output (#55814) --- paddle/fluid/ir_adaptor/translator/program_translator.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle/fluid/ir_adaptor/translator/program_translator.cc b/paddle/fluid/ir_adaptor/translator/program_translator.cc index 7eb3b57d7ad..3c16eebc349 100644 --- a/paddle/fluid/ir_adaptor/translator/program_translator.cc +++ b/paddle/fluid/ir_adaptor/translator/program_translator.cc @@ -163,6 +163,11 @@ void ProgramTranslator::InsertOperationToSingleBlock(const BlockDesc& block) { auto& op_translator = OpTranslator::instance(); for (auto op : block.AllOps()) { OpTranslateFn& fn = op_translator[op->Type()]; + if (op->Type() == "shaddow_output") { + if (!param_map_.count(op->Input("x")[0])) { + continue; + } + } ir::Operation* operation = fn(ctx_, ¶m_map_, *op, program_); VLOG(10) << "[op translated][special]" << operation; } @@ -180,6 +185,10 @@ void ProgramTranslator::SetParameterFromSingleBlock(const BlockDesc& block) { need_set_parameter_op &= (param_map_.count(var_name) != 0); if (need_set_parameter_op) { ir::OpResult defining_op_result = param_map_[var_name].value; + if (!defining_op_result) { + continue; + } + ir::Operation* op = InsertSetParamaterOp( ctx_, defining_op_result, parameter_name_mappings_[var_name]); -- GitLab