!10961 fix CreateSession api in lite_session.h

From: @hangangqiang
Reviewed-by: @ddwsky,@zhang_xue_tong
Signed-off-by: @zhang_xue_tong
pull/10961/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 444550246f

@ -547,6 +547,7 @@ LiteSession::~LiteSession() {
mindspore::lite::NPUPassManager::GetInstance()->Clear();
mindspore::lite::NPUManager::GetInstance()->Reset();
#endif
delete (model_);
is_running_.store(false);
}
@ -723,7 +724,7 @@ session::LiteSession *session::LiteSession::CreateSession(const char *model_buf,
return nullptr;
}
model->buf = nullptr;
delete (model);
(reinterpret_cast<lite::LiteSession *>(session))->set_model(model);
return session;
}
} // namespace mindspore

@ -66,6 +66,8 @@ class LiteSession : public session::LiteSession {
int Resize(const std::vector<mindspore::tensor::MSTensor *> &inputs,
const std::vector<std::vector<int>> &dims) override;
void set_model(Model *model) { this->model_ = model; }
protected:
static void ConvertTensorsQuantParam(const schema::Tensor *src_tensor, lite::Tensor *dst_tensor);
@ -123,6 +125,7 @@ class LiteSession : public session::LiteSession {
// graph output tensor name -- output tensor
std::unordered_map<std::string, mindspore::tensor::MSTensor *> output_tensor_map_;
Executor *executor_ = nullptr;
Model *model_ = nullptr;
std::atomic<bool> is_running_ = false;
#if SUPPORT_GPU && !SUPPORT_TRAIN
opencl::OpenCLRuntimeWrapper ocl_runtime_wrap_;

Loading…
Cancel
Save