From b9a7af7b05bf8962010a2de2d9e86e7492b68e87 Mon Sep 17 00:00:00 2001 From: zhoufeng Date: Sat, 18 Dec 2021 17:22:01 +0800 Subject: [PATCH] fix load fail log Signed-off-by: zhoufeng --- mindspore/ccsrc/cxx_api/model/acl/acl_model.cc | 14 +++++++++++--- mindspore/ccsrc/cxx_api/serialization.cc | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/cxx_api/model/acl/acl_model.cc b/mindspore/ccsrc/cxx_api/model/acl/acl_model.cc index 30670e5f124..427ab0ccf04 100644 --- a/mindspore/ccsrc/cxx_api/model/acl/acl_model.cc +++ b/mindspore/ccsrc/cxx_api/model/acl/acl_model.cc @@ -33,15 +33,23 @@ Status AclModel::Build() { return kSuccess; } + std::shared_ptr options = std::make_shared(model_context_); + MS_EXCEPTION_IF_NULL(options); + if (graph_cell_ == nullptr && graph_->ModelType() == ModelType::kOM) { - MS_LOG(INFO) << "Note: Load om model and all build options will be ignored."; + MS_LOG(INFO) << "Load om model and all build options will be ignored."; graph_cell_ = std::make_shared(graph_); MS_EXCEPTION_IF_NULL(graph_cell_); + auto ret = graph_cell_->Load(options->GetDeviceID()); + if (ret != kSuccess) { + MS_LOG(ERROR) << "Load failed."; + return ret; + } + + options_ = std::move(options); return kSuccess; } - std::shared_ptr options = std::make_shared(model_context_); - MS_EXCEPTION_IF_NULL(options); std::string options_key = options->GenAclOptionsKey(); std::shared_ptr graph; if (auto iter = dynamic_size_graph_map_.find(options_key); iter != dynamic_size_graph_map_.end()) { diff --git a/mindspore/ccsrc/cxx_api/serialization.cc b/mindspore/ccsrc/cxx_api/serialization.cc index d29630c2f28..f5a72f29e1b 100644 --- a/mindspore/ccsrc/cxx_api/serialization.cc +++ b/mindspore/ccsrc/cxx_api/serialization.cc @@ -187,7 +187,7 @@ Status Serialization::Load(const std::vector &file, ModelType model_type, false); anf_graph = mindir_loader.LoadMindIR(file_path); if (anf_graph == nullptr) { - err_msg << "Load model failed. Please check the valid of dec_key and dec_mode"; + err_msg << "Load model failed."; MS_LOG(ERROR) << err_msg.str(); return Status(kMEInvalidInput, err_msg.str()); }