!27119 [MSLITE] runtime convert bug

Merge pull request !27119 from ling/pr
This commit is contained in:
i-robot 2021-12-02 11:13:13 +00:00 committed by Gitee
commit ac8fac150c
2 changed files with 9 additions and 3 deletions

View File

@ -52,7 +52,7 @@ Status Serialization::Load(const void *model_data, size_t data_size, ModelType m
MS_LOG(ERROR) << "graph is nullptr.";
return kLiteNullptr;
}
if (model_type != kMindIR) {
if (model_type != kMindIR && model_type != kMindIR_Opt) {
MS_LOG(ERROR) << "Unsupported IR.";
return kLiteInputParamInvalid;
}
@ -82,7 +82,7 @@ Status Serialization::Load(const std::vector<char> &file, ModelType model_type,
MS_LOG(ERROR) << "graph is nullptr.";
return kLiteNullptr;
}
if (model_type != kMindIR) {
if (model_type != kMindIR && model_type != kMindIR_Opt) {
MS_LOG(ERROR) << "Unsupported IR.";
return kLiteInputParamInvalid;
}

View File

@ -1543,7 +1543,13 @@ int lite::LiteSession::CreateSessionByBuf(const char *model_buf, mindspore::Mode
int lite::LiteSession::CreateSessionByPath(const std::string &model_path, mindspore::ModelType model_type,
session::LiteSession *session) {
auto *model = lite::ImportFromPath(model_path.c_str());
size_t model_size;
auto model_buf = LoadModelByPath(model_path, model_type, &model_size);
if (model_buf == nullptr) {
MS_LOG(ERROR) << "Read model file failed";
return RET_ERROR;
}
auto *model = lite::ImportFromBuffer(model_buf, model_size, true);
if (model == nullptr) {
MS_LOG(ERROR) << "Import model failed";
return RET_ERROR;