From 43a2d2e42c27c565988ddb85193419b19fc65b53 Mon Sep 17 00:00:00 2001 From: lixian Date: Sat, 20 Feb 2021 10:03:25 +0800 Subject: [PATCH] fix return value for second build --- mindspore/lite/src/cxx_api/model/model_impl.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mindspore/lite/src/cxx_api/model/model_impl.cc b/mindspore/lite/src/cxx_api/model/model_impl.cc index 0aa48361a3..b0a3d85efd 100644 --- a/mindspore/lite/src/cxx_api/model/model_impl.cc +++ b/mindspore/lite/src/cxx_api/model/model_impl.cc @@ -35,6 +35,10 @@ using mindspore::lite::RET_OK; Status ModelImpl::Build() { MS_LOG(DEBUG) << "Start build model."; + if (session_ != nullptr) { + MS_LOG(DEBUG) << "Model has been already built."; + return kSuccess; + } if (graph_cell_ == nullptr || graph_cell_->GetGraph() == nullptr || graph_cell_->GetGraph()->graph_data_ == nullptr) { MS_LOG(ERROR) << "Graph cell is invalid."; return kLiteNullptr; @@ -48,10 +52,6 @@ Status ModelImpl::Build() { MS_LOG(ERROR) << "Lite model has been freed."; return kLiteError; } - if (session_ != nullptr) { - MS_LOG(DEBUG) << "Model has been already built."; - return kSuccess; - } if (context_ == nullptr) { MS_LOG(ERROR) << "Invalid context."; return kLiteNullptr;