diff --git a/paddle/fluid/framework/ir/constant_folding_pass.cc b/paddle/fluid/framework/ir/constant_folding_pass.cc index feba2242ad68e0bec81271a74649b98bbf99cc12..ac82c6b73f37d2f64afe71e9a7ca68884d3ef5d5 100644 --- a/paddle/fluid/framework/ir/constant_folding_pass.cc +++ b/paddle/fluid/framework/ir/constant_folding_pass.cc @@ -142,6 +142,9 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const { } out_desc->SetShape(out_shape); out_desc->SetPersistable(true); + auto *var_desc_out = op_node->Op()->Block()->Var(out_name); + var_desc_out->SetShape(out_shape); + var_desc_out->SetPersistable(true); auto *global_out_tensor = scope->Var(out_name)->GetMutable(); *global_out_tensor = *local_out_tensor; }