未验证 提交 70288456 编写于 作者: 周周周 提交者: GitHub

commit (#54894)

上级 67c69dca
......@@ -65,6 +65,7 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const {
"scope must not be null when applying constant folding."));
std::vector<std::string> blacklist{"feed", "matrix_multiply", "save"};
int folded_op_num = 0;
auto op_node_sorted = framework::ir::TopologyVarientSort(
*graph, static_cast<framework::ir::SortKind>(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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册