diff --git a/parser/onnx/onnx_parser.cc b/parser/onnx/onnx_parser.cc index f3f78ee..e66b550 100644 --- a/parser/onnx/onnx_parser.cc +++ b/parser/onnx/onnx_parser.cc @@ -506,7 +506,6 @@ Status OnnxModelParser::GetModelFromFile(const char *file, ge::onnx::ModelProto GELOGI("File path is %s.", file); // 1. Get graph from onnx model file. - ge::onnx::ModelProto onnx_model; if (!ge::parser::ReadProtoFromBinaryFile(file, onnx_model)) { ErrorManager::GetInstance().ATCReportErrMessage( "E19021", {"reason"}, {"Read onnx model file failed."}); @@ -520,11 +519,10 @@ Status OnnxModelParser::GetModelFromMemory(const char *data, uint32_t size, ge:: GE_CHECK_NOTNULL(data); // 1. Get graph from onnx model file. - ge::onnx::ModelProto onnx_model; - if (!ge::parser::ReadProtoFromArray(file, onnx_model)) { + if (!ge::parser::ReadProtoFromArray(data, onnx_model)) { ErrorManager::GetInstance().ATCReportErrMessage( "E19021", {"reason"}, {"Read onnx model from memory failed."}); - GELOGE(PARAM_INVALID, "Read onnx model file failed."); + GELOGE(PARAM_INVALID, "Read onnx model from memory failed."); return FAILED; } return SUCCESS; @@ -652,6 +650,7 @@ Status OnnxModelParser::ParseFromMemory(const char *data, uint32_t size, ge::Gra return FAILED; } } + Status OnnxModelParser::ToJson(const char *model_file, const char *json_file) { if (model_file == nullptr) { GELOGE(FAILED, "Model file is nullptr.");