diff --git a/paddle/fluid/framework/ir/constant_folding_pass.cc b/paddle/fluid/framework/ir/constant_folding_pass.cc index 044514246442339d2b25874e3ca176c09df0bf98..468d74478c8bfe73c5b4b8dbb96d43a42f8dd4a4 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