From 74d2ca2126807baab366848771355a2e04a7f18d Mon Sep 17 00:00:00 2001 From: zhengyuanhua Date: Fri, 20 Nov 2020 15:45:05 +0800 Subject: [PATCH] external interface modify: string change to ascendstring --- metadef | 2 +- parser/CMakeLists.txt | 1 + parser/common/CMakeLists.txt | 1 + parser/common/module.mk | 2 +- parser/module.mk | 2 +- parser/onnx/CMakeLists.txt | 1 + parser/onnx/module.mk | 2 +- parser/tensorflow/tensorflow_parser.cc | 22 ++++++++++++++++------ 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/metadef b/metadef index c9b6960..4aabad3 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit c9b6960725036291ed2328f5751beb4f01247526 +Subproject commit 4aabad33f2a0ba7380d4b0baf96712256dff53e7 diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt index 75e2fa8..6419f74 100644 --- a/parser/CMakeLists.txt +++ b/parser/CMakeLists.txt @@ -48,6 +48,7 @@ add_library(fmk_parser SHARED ${SRC_LIST} ${PROTO_SRCS}) target_compile_options(fmk_parser PRIVATE -Werror + -Wno-deprecated-declarations ) target_compile_definitions(fmk_parser PRIVATE diff --git a/parser/common/CMakeLists.txt b/parser/common/CMakeLists.txt index 91d8d80..dcfc5a5 100644 --- a/parser/common/CMakeLists.txt +++ b/parser/common/CMakeLists.txt @@ -32,6 +32,7 @@ add_library(parser_common SHARED ${SRC_LIST}) target_compile_options(parser_common PRIVATE -Werror + -Wno-deprecated-declarations ) target_compile_definitions(parser_common PRIVATE diff --git a/parser/common/module.mk b/parser/common/module.mk index ec2a1ac..79210c5 100644 --- a/parser/common/module.mk +++ b/parser/common/module.mk @@ -5,7 +5,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libparser_common LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -LOCAL_CFLAGS += -Werror -Dgoogle=ascend_private +LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations -Dgoogle=ascend_private ifeq ($(DEBUG), 1) LOCAL_CFLAGS += -g -O0 endif diff --git a/parser/module.mk b/parser/module.mk index db6146e..8847790 100644 --- a/parser/module.mk +++ b/parser/module.mk @@ -58,7 +58,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libfmk_parser LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -LOCAL_CFLAGS += -Werror -Dgoogle=ascend_private +LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations -Dgoogle=ascend_private ifeq ($(DEBUG), 1) LOCAL_CFLAGS += -g -O0 endif diff --git a/parser/onnx/CMakeLists.txt b/parser/onnx/CMakeLists.txt index 99d2059..82dc484 100644 --- a/parser/onnx/CMakeLists.txt +++ b/parser/onnx/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(fmk_onnx_parser SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(fmk_onnx_parser PRIVATE -Werror + -Wno-deprecated-declarations ) target_compile_definitions(fmk_onnx_parser PRIVATE diff --git a/parser/onnx/module.mk b/parser/onnx/module.mk index 5c726e7..3ba1f91 100644 --- a/parser/onnx/module.mk +++ b/parser/onnx/module.mk @@ -6,7 +6,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libfmk_onnx_parser LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -LOCAL_CFLAGS += -Werror -Dgoogle=ascend_private +LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations -Dgoogle=ascend_private ifeq ($(DEBUG), 1) LOCAL_CFLAGS += -g -O0 endif diff --git a/parser/tensorflow/tensorflow_parser.cc b/parser/tensorflow/tensorflow_parser.cc index bce0002..62fa6ad 100644 --- a/parser/tensorflow/tensorflow_parser.cc +++ b/parser/tensorflow/tensorflow_parser.cc @@ -234,11 +234,17 @@ Status PostOpProcessForSubgraph(const ParseArg &arg) { 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_subgraph = 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_subgraph) != SUCCESS || + parse_subgraph == nullptr) { + GELOGW("The subgraph new post func 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 +259,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_subgraph != nullptr) { + ret = parse_subgraph(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