!49908 codegen bugfix, when no fmk configure, return error

Merge pull request !49908 from zhangyanhui/mas_micro
This commit is contained in:
i-robot 2023-03-08 02:24:26 +00:00 committed by Gitee
commit 4d14ae79bd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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) {