forked from mindspore-Ecosystem/mindspore
!6496 fix multi session CompileGraph bug
Merge pull request !6496 from hangq/primitive
This commit is contained in:
commit
a478344c40
|
@ -284,7 +284,6 @@ int LiteSession::CompileGraph(Model *model) {
|
|||
is_running_.store(false);
|
||||
return ret;
|
||||
}
|
||||
model->Free();
|
||||
is_running_.store(false);
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue