From e7a283e3c906543fbda2347820d38fff7994dbcf Mon Sep 17 00:00:00 2001 From: wjm Date: Wed, 9 Jun 2021 01:17:03 +0800 Subject: [PATCH] fix --- parser/common/convert/message2operator.cc | 1 + parser/onnx/onnx_custom_parser_adapter.cc | 20 ++++++++++++-------- parser/onnx/onnx_parser.cc | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/parser/common/convert/message2operator.cc b/parser/common/convert/message2operator.cc index 2f08049..5725200 100644 --- a/parser/common/convert/message2operator.cc +++ b/parser/common/convert/message2operator.cc @@ -29,6 +29,7 @@ const uint32_t kInteval = 2; } // namespace Status Message2Operator::ParseOperatorAttrs(const google::protobuf::Message *message, int depth, ge::Operator &ops) { + GE_CHECK_NOTNULL(message); if (depth > kMaxParseDepth) { REPORT_INNER_ERROR("E19999", "Message depth:%d can not exceed %d.", depth, kMaxParseDepth); GELOGE(FAILED, "[Check][Param]Message depth can not exceed %d.", kMaxParseDepth); diff --git a/parser/onnx/onnx_custom_parser_adapter.cc b/parser/onnx/onnx_custom_parser_adapter.cc index b3e112d..1534dff 100644 --- a/parser/onnx/onnx_custom_parser_adapter.cc +++ b/parser/onnx/onnx_custom_parser_adapter.cc @@ -15,24 +15,25 @@ */ #include "parser/onnx/onnx_custom_parser_adapter.h" + #include "common/util.h" #include "framework/common/debug/ge_log.h" #include "parser/common/op_parser_factory.h" #include "register/op_registry.h" -using domi::ParseParamFunc; -using domi::ParseParamByOpFunc; using domi::ONNX; +using domi::ParseParamByOpFunc; +using domi::ParseParamFunc; -namespace ge{ +namespace ge { Status OnnxCustomParserAdapter::ParseParams(const Message *op_src, ge::Operator &op_dest) { GE_CHECK_NOTNULL(op_src); const ge::onnx::NodeProto *node_src = reinterpret_cast(op_src); GE_CHECK_NOTNULL(node_src); GELOGI("Onnx op node name = %s, op type= %s, parse params.", node_src->name().c_str(), node_src->op_type().c_str()); - ParseParamFunc - custom_op_parser = domi::OpRegistry::Instance()->GetParseParamFunc(op_dest.GetOpType(), node_src->op_type()); + ParseParamFunc custom_op_parser = + domi::OpRegistry::Instance()->GetParseParamFunc(op_dest.GetOpType(), node_src->op_type()); GE_CHECK_NOTNULL(custom_op_parser); if (custom_op_parser(op_src, op_dest) != SUCCESS) { GELOGE(FAILED, "[Invoke][Custom_Op_Parser] Custom parser params failed."); @@ -45,9 +46,12 @@ Status OnnxCustomParserAdapter::ParseParams(const Operator &op_src, Operator &op ParseParamByOpFunc custom_op_parser = domi::OpRegistry::Instance()->GetParseParamByOperatorFunc(op_src.GetOpType()); GE_CHECK_NOTNULL(custom_op_parser); - GE_CHK_BOOL_RET_STATUS(custom_op_parser(op_src, op_dest) == SUCCESS, FAILED, - "[Invoke][CustomOpParser] failed, node name:%s, type:%s", - op_src.GetName().c_str(), op_src.GetOpType().c_str()); + if (custom_op_parser(op_src, op_dest) != SUCCESS) { + GELOGE(FAILED, "[Invoke][Custom_Op_Parser] failed, node name:%s, type:%s", op_src.GetName().c_str(), + op_src.GetOpType().c_str()); + return FAILED; + } + return SUCCESS; } diff --git a/parser/onnx/onnx_parser.cc b/parser/onnx/onnx_parser.cc index a7178aa..fa67da7 100644 --- a/parser/onnx/onnx_parser.cc +++ b/parser/onnx/onnx_parser.cc @@ -623,7 +623,7 @@ Status OnnxModelParser::ParseAllNodeProto(ge::onnx::GraphProto &onnx_graph, ge:: GE_CHECK_NOTNULL(op_parser); status = ParseOpParam(node_proto, op, op_parser); if (status != SUCCESS) { - GELOGE(status, "Parse params for node[%s] failed", node_name.c_str()); + GELOGE(status, "[Parse][Params] for %s:%s failed ret:%d.", node_name.c_str(), op_type.c_str(), status); return status; }