From a319d2d1f4de22e3cc2bb20bdf13128854202950 Mon Sep 17 00:00:00 2001 From: zhengyuanhua Date: Fri, 27 Nov 2020 09:31:56 +0800 Subject: [PATCH] external interface: string changes ascendstring --- metadef | 2 +- parser/CMakeLists.txt | 2 ++ parser/tensorflow/tensorflow_parser.cc | 23 ++++++++++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/metadef b/metadef index 6bdf2e3..4839ad5 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 6bdf2e3011150b200fdcd2acd18b7186902534b6 +Subproject commit 4839ad5e4666c5d126537208ff5d45df175d6ea8 diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt index 35ce7fa..c58092e 100644 --- a/parser/CMakeLists.txt +++ b/parser/CMakeLists.txt @@ -54,6 +54,7 @@ target_compile_options(fmk_parser PRIVATE target_compile_definitions(fmk_parser PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 google=ascend_private + $<$:ONLY_COMPILE_OPEN_SRC> ) target_include_directories(fmk_parser PRIVATE @@ -138,6 +139,7 @@ target_compile_definitions(fmk_parser_stub PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 REUSE_MEMORY=1 FMK_HOST_INFER + $<$:ONLY_COMPILE_OPEN_SRC> ) target_include_directories(fmk_parser_stub PRIVATE diff --git a/parser/tensorflow/tensorflow_parser.cc b/parser/tensorflow/tensorflow_parser.cc index bce0002..25f6734 100644 --- a/parser/tensorflow/tensorflow_parser.cc +++ b/parser/tensorflow/tensorflow_parser.cc @@ -233,12 +233,17 @@ Status PostOpProcessForSubgraph(const ParseArg &arg) { if (arg.parent_node == nullptr) { return SUCCESS; } - - auto post_func = domi::OpRegistry::Instance()->GetParseSubgraphPostFunc(arg.parent_node->GetType()); + std::string op_type = arg.parent_node->GetType(); + std::string op_name = arg.parent_node->GetName(); + domi::ParseSubgraphFuncV2 parse_func_v2 = nullptr; + auto post_func = domi::OpRegistry::Instance()->GetParseSubgraphPostFunc(op_type); if (post_func == nullptr) { - GELOGW("The subgraph post func for node %s type %s is null", arg.parent_node->GetName().c_str(), - arg.parent_node->GetType().c_str()); - return SUCCESS; + GELOGW("The subgraph post func for node %s type %s is null", op_name.c_str(), op_type.c_str()); + if (domi::OpRegistry::Instance()->GetParseSubgraphPostFunc(op_type, parse_func_v2) != SUCCESS || + parse_func_v2 == nullptr) { + GELOGW("The subgraph post func v2 for node %s type %s is null", op_name.c_str(), op_type.c_str()); + return SUCCESS; + } } GELOGD("Post process for subgraph %s node %s type %s subgraph name %s", arg.function_name.c_str(), @@ -253,13 +258,17 @@ Status PostOpProcessForSubgraph(const ParseArg &arg) { } auto graph = ge::GraphUtils::CreateGraphFromComputeGraph(arg.graph); - auto ret = post_func(arg.subgraph_name, graph); + Status ret = FAILED; + if (post_func != nullptr) { + ret = post_func(arg.subgraph_name, graph); + } else if (parse_func_v2 != nullptr) { + ret = parse_func_v2(arg.subgraph_name.c_str(), graph); + } if (ret != SUCCESS) { GELOGE(FAILED, "Failed to post-process subgraph %s on node %s type %s subgraph name %s", arg.function_name.c_str(), arg.parent_node->GetName().c_str(), arg.parent_node->GetType().c_str(), arg.subgraph_name.c_str()); return FAILED; } - return SUCCESS; } } // namespace