|
|
|
@ -963,6 +963,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js
|
|
|
|
|
OmFileLoadHelper omFileLoadHelper;
|
|
|
|
|
ge::graphStatus status = omFileLoadHelper.Init(model_data, model_len);
|
|
|
|
|
if (status != ge::GRAPH_SUCCESS) {
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "Om file init failed");
|
|
|
|
|
GELOGE(ge::FAILED, "Om file init failed.");
|
|
|
|
|
if (model.model_data != nullptr) {
|
|
|
|
|
delete[] reinterpret_cast<char *>(model.model_data);
|
|
|
|
@ -974,6 +975,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js
|
|
|
|
|
ModelPartition ir_part;
|
|
|
|
|
status = omFileLoadHelper.GetModelPartition(MODEL_DEF, ir_part);
|
|
|
|
|
if (status != ge::GRAPH_SUCCESS) {
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "Get model part failed");
|
|
|
|
|
GELOGE(ge::FAILED, "Get model part failed.");
|
|
|
|
|
if (model.model_data != nullptr) {
|
|
|
|
|
delete[] reinterpret_cast<char *>(model.model_data);
|
|
|
|
@ -999,9 +1001,12 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ret = INTERNAL_ERROR;
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "ReadProtoFromArray failed");
|
|
|
|
|
GELOGE(ret, "ReadProtoFromArray failed.");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E10003",
|
|
|
|
|
{"parameter", "value", "reason"}, {"om", model_file, "invalid om file"});
|
|
|
|
|
GELOGE(PARAM_INVALID, "ParseModelContent failed because of invalid om file. Please check --om param.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1011,6 +1016,8 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
} catch (const std::exception &e) {
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "Convert om model to json failed, exception message[" +
|
|
|
|
|
e.what() + "]");
|
|
|
|
|
GELOGE(FAILED, "Convert om model to json failed, exception message : %s.", e.what());
|
|
|
|
|
return FAILED;
|
|
|
|
|
}
|
|
|
|
@ -1041,7 +1048,8 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const
|
|
|
|
|
|
|
|
|
|
if (!flag) {
|
|
|
|
|
free_model_data(&model.model_data);
|
|
|
|
|
GELOGE(FAILED, "ParseFromString fail.");
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "ParseFromString failed");
|
|
|
|
|
GELOGE(FAILED, "ParseFromString failed.");
|
|
|
|
|
return FAILED;
|
|
|
|
|
}
|
|
|
|
|
GetGroupName(model_def);
|
|
|
|
@ -1057,9 +1065,13 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
} catch (google::protobuf::FatalException &e) {
|
|
|
|
|
free_model_data(&model.model_data);
|
|
|
|
|
GELOGE(FAILED, "ParseFromString fail. exception message : %s", e.what());
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "ParseFromString failed, exception message[" +
|
|
|
|
|
e.what() + "]");
|
|
|
|
|
GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what());
|
|
|
|
|
return FAILED;
|
|
|
|
|
} catch (const std::exception &e) {
|
|
|
|
|
ErrorManager::GetInstance().ATCReportErrMessage("E19021", "Convert pbtxt to json failed, exception message[" +
|
|
|
|
|
e.what() + "]");
|
|
|
|
|
GELOGE(FAILED, "Convert pbtxt to json failed, exception message : %s.", e.what());
|
|
|
|
|
return FAILED;
|
|
|
|
|
}
|
|
|
|
|