Browse Source

add constant folding original_op_names for dump

pull/540/head
zhaoxinxin 4 years ago
parent
commit
1799b3e6cb
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      ge/graph/passes/folding_pass.cc

+ 9
- 1
ge/graph/passes/folding_pass.cc View File

@@ -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<std::string>()));
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<string> 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


Loading…
Cancel
Save