From 1799b3e6cbe997c145327b703d15bc30962828db Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Mon, 7 Dec 2020 17:06:20 +0800 Subject: [PATCH] add constant folding original_op_names for dump --- ge/graph/passes/folding_pass.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ge/graph/passes/folding_pass.cc b/ge/graph/passes/folding_pass.cc index 93dc2c40..cd7f8ad0 100755 --- a/ge/graph/passes/folding_pass.cc +++ b/ge/graph/passes/folding_pass.cc @@ -84,10 +84,10 @@ NodePtr AddConstNodeToGraph(GeTensorPtr &tensor, ComputeGraphPtr &graph) { } GE_IF_BOOL_EXEC(graph == nullptr, GELOGW("input param graph is null"); return nullptr); - (void) AttrUtils::SetListStr(const_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, std::move(std::vector())); return graph->AddNodeFront(const_desc); } + NodePtr AddIdentityNodeToGraph(const std::string &name, const GeTensorDesc &tensor, ComputeGraphPtr &graph) { if (graph == nullptr) { GELOGE(INTERNAL_ERROR, "Compute graph ptr is null in creating identity node."); @@ -241,6 +241,14 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho node->GetName().c_str(), index); return INTERNAL_ERROR; } + vector curr_origin_op_names; + (void)AttrUtils::GetListStr(node->GetOpDesc(), curr_origin_op_names); + if (curr_origin_op_names.empty()) { + (void)AttrUtils::SetListStr(const_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, std::move({node->GetName()})); + } else { + (void)AttrUtils::SetListStr(const_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, curr_origin_op_names); + } + GELOGI("add const_node:%s, replace node %s, type %s, index %zu.", const_node->GetName().c_str(), node->GetName().c_str(), node->GetType().c_str(), index); // add new const to re-pass node