Browse Source

fix

pull/321/head
wjm 4 years ago
parent
commit
e7a283e3c9
3 changed files with 14 additions and 9 deletions
  1. +1
    -0
      parser/common/convert/message2operator.cc
  2. +12
    -8
      parser/onnx/onnx_custom_parser_adapter.cc
  3. +1
    -1
      parser/onnx/onnx_parser.cc

+ 1
- 0
parser/common/convert/message2operator.cc View File

@@ -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);


+ 12
- 8
parser/onnx/onnx_custom_parser_adapter.cc View File

@@ -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<const ge::onnx::NodeProto *>(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;
}



+ 1
- 1
parser/onnx/onnx_parser.cc View File

@@ -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;
}



Loading…
Cancel
Save