From bc61c7967a40b4553a782df4bc35d8709ad6a418 Mon Sep 17 00:00:00 2001 From: ming1753 <61511741+ming1753@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:04:07 +0800 Subject: [PATCH] fix bug of constant folding pass (#55556) --- paddle/fluid/framework/ir/constant_folding_pass.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paddle/fluid/framework/ir/constant_folding_pass.cc b/paddle/fluid/framework/ir/constant_folding_pass.cc index 751a7e8dd7f..41c5eac81a1 100644 --- a/paddle/fluid/framework/ir/constant_folding_pass.cc +++ b/paddle/fluid/framework/ir/constant_folding_pass.cc @@ -83,6 +83,8 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const { map[in_node->Name()] = 0; if (!in_node->Var()->Persistable()) { input_persis = false; + } else if (!in_node->inputs.empty()) { + input_persis = false; } } for (auto out_node : op_node->outputs) { -- GitLab