From 702884567125e0a5efe3941cc325c2dbaca0c29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=91=A8=E5=91=A8?= <39978853+zhoutianzi666@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:35:50 +0800 Subject: [PATCH] commit (#54894) --- paddle/fluid/framework/ir/constant_folding_pass.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paddle/fluid/framework/ir/constant_folding_pass.cc b/paddle/fluid/framework/ir/constant_folding_pass.cc index 04451424644..468d74478c8 100644 --- a/paddle/fluid/framework/ir/constant_folding_pass.cc +++ b/paddle/fluid/framework/ir/constant_folding_pass.cc @@ -65,6 +65,7 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const { "scope must not be null when applying constant folding.")); std::vector blacklist{"feed", "matrix_multiply", "save"}; + int folded_op_num = 0; auto op_node_sorted = framework::ir::TopologyVarientSort( *graph, static_cast(0)); @@ -130,6 +131,7 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const { if (out_node->outputs.size() == 0L) remove_nodes.emplace(out_node); } op->Run(*local_scope, platform::CPUPlace()); + folded_op_num++; for (auto out_node : op_node->outputs) { // this out_node is useless, do not set it persistable if (out_node->outputs.size() == 0L) continue; @@ -155,6 +157,7 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const { } delete local_scope; } + LOG(INFO) << folded_op_num << " Ops are folded"; } } // namespace ir -- GitLab