codegen bugfix, when no fmk configure, return error

This commit is contained in:
zhangyanhui 2023-03-07 15:30:24 +08:00
parent f2c7cbb3bc
commit 96d1ffef67
1 changed files with 5 additions and 1 deletions

View File

@ -267,9 +267,13 @@ std::shared_ptr<ConverterPara> CreateConvertParam(const std::map<std::string, st
{"inputDataFormat", InitModelInputDataFormat},
{"infer", InitModelInfer},
{"NoFusion", InitModelNoFusion}};
if (model_params.find("fmk") == model_params.end() || model_params.find("modelFile") == model_params.end()) {
MS_LOG(ERROR) << "INPUT ILLEGAL: fmk and modelFile must be set in [model_param].";
return nullptr;
}
for (auto &pair : model_params) {
if (parse_funcs.find(pair.first) == parse_funcs.end()) {
MS_LOG(ERROR) << pair.first << "is not a valid flag";
MS_LOG(ERROR) << "In multi-model scenario, " << pair.first << " is not supported";
return nullptr;
}
if (parse_funcs[pair.first](pair.second, parm) != RET_OK) {