!6496 fix multi session CompileGraph bug

Merge pull request !6496 from hangq/primitive
This commit is contained in:
mindspore-ci-bot 2020-09-19 09:53:26 +08:00 committed by Gitee
commit a478344c40
4 changed files with 5 additions and 6 deletions

View File

@ -284,7 +284,6 @@ int LiteSession::CompileGraph(Model *model) {
is_running_.store(false);
return ret;
}
model->Free();
is_running_.store(false);
return RET_OK;
}

View File

@ -85,12 +85,15 @@ Model *Model::Import(const char *model_buf, size_t size) {
model->buf = reinterpret_cast<char *>(malloc(size));
if (model->buf == nullptr) {
MS_LOG(ERROR) << "new inner model buf fail!";
delete(model);
return nullptr;
}
memcpy(model->buf, model_buf, size);
auto meta_graph = schema::GetMetaGraph(model->buf);
if (meta_graph == nullptr) {
MS_LOG(ERROR) << "meta_graph is nullptr!";
delete(model);
free(model->buf);
return nullptr;
}

View File

@ -355,10 +355,6 @@ int Benchmark::RunBenchmark(const std::string &deviceType) {
return RET_ERROR;
}
auto model = lite::Model::Import(graphBuf, size);
auto model_version = model->version_;
if (model_version != Version()) {
MS_LOG(WARNING) << "model version is " << model_version << ", inference version is " << Version() << " not equal";
}
if (model == nullptr) {
MS_LOG(ERROR) << "Import model file failed while running " << modelName.c_str();
std::cerr << "Import model file failed while running " << modelName.c_str() << std::endl;
@ -404,6 +400,7 @@ int Benchmark::RunBenchmark(const std::string &deviceType) {
delete (model);
return ret;
}
model->Free();
msInputs = session->GetInputs();
auto endPrepareTime = GetTimeUs();
#if defined(__arm__)

View File

@ -17,8 +17,8 @@
#include "tools/converter/parser/tflite/tflite_pad_parser.h"
#include <vector>
#include <memory>
#include <map>
#include <string>
#include <map>
namespace mindspore {
namespace lite {