From 6608471b5123bfafb965efa57c5e36cb6e39182c Mon Sep 17 00:00:00 2001 From: wjm Date: Mon, 8 Feb 2021 09:58:44 +0800 Subject: [PATCH] bug --- ge/common/helper/model_helper.cc | 9 ++++----- inc/framework/omg/model_tool.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 33570db7..dc68e38e 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -900,7 +900,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelTool::GetModelInfoF ge::ModelData model; int32_t priority = 0; - // Load model from file Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); if (ret != SUCCESS) { GELOGE(ret, "LoadFromFile failed."); @@ -915,7 +914,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelTool::GetModelInfoF uint8_t *model_data = nullptr; uint32_t model_len = 0; - // Parse the contents of the file to get the modeldef object + ret = ModelParserBase::ParseModelContent(model, model_data, model_len); if (ret != SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E10003", @@ -943,7 +942,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelTool::GetModelInfoF } bool flag = ReadProtoFromArray(ir_part.data, ir_part.size, &model_def); - if (flag) { + if (!flag) { ret = INTERNAL_ERROR; ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); GELOGE(ret, "ReadProtoFromArray failed."); @@ -957,7 +956,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelTool::GetModelInfoF GE_CHECK_NOTNULL(model_file); ge::ModelData model; int32_t priority = 0; - // Load model from file + Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); auto free_model_data = [](void **ptr) -> void { if (ptr != nullptr && *ptr != nullptr) { @@ -984,7 +983,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelTool::GetModelInfoF } catch (google::protobuf::FatalException &e) { free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" - + std::string(e.what()) + "]"}); + + std::string(e.what()) + "]"}); GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what()); return FAILED; } diff --git a/inc/framework/omg/model_tool.h b/inc/framework/omg/model_tool.h index 825e3f23..589e7cd9 100644 --- a/inc/framework/omg/model_tool.h +++ b/inc/framework/omg/model_tool.h @@ -31,4 +31,5 @@ class GE_FUNC_VISIBILITY ModelTool { static Status GetModelInfoFromPbtxt(const char *model_file, ge::proto::ModelDef &model_def); }; } // namespace ge + #endif // INC_FRAMEWORK_OMG_MODEL_TOOL_H_