!12531 error when loadmodel a unexist file

From: @zhoufeng54
Reviewed-by: @xu-yfei,@kisnwang
Signed-off-by: @xu-yfei
pull/12531/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit c09968160f

@ -24,6 +24,7 @@
#include "backend/session/session_factory.h" #include "backend/session/session_factory.h"
#include "backend/session/executor_manager.h" #include "backend/session/executor_manager.h"
#include "runtime/device/kernel_runtime_manager.h" #include "runtime/device/kernel_runtime_manager.h"
#include "runtime/dev.h"
namespace mindspore { namespace mindspore {
API_FACTORY_REG(GraphCell::GraphImpl, Ascend910, AscendGraphImpl); API_FACTORY_REG(GraphCell::GraphImpl, Ascend910, AscendGraphImpl);

@ -86,13 +86,10 @@ Graph Serialization::LoadModel(const void *model_data, size_t data_size, ModelTy
Graph Serialization::LoadModel(const std::string &file, ModelType model_type) { Graph Serialization::LoadModel(const std::string &file, ModelType model_type) {
if (model_type == kMindIR) { if (model_type == kMindIR) {
FuncGraphPtr anf_graph = nullptr; FuncGraphPtr anf_graph = LoadMindIR(file);
try { if (anf_graph == nullptr) {
anf_graph = LoadMindIR(file); MS_LOG(EXCEPTION) << "Load model failed.";
} catch (const std::exception &) {
MS_LOG(EXCEPTION) << "Load MindIR failed.";
} }
return Graph(std::make_shared<Graph::GraphData>(anf_graph, kMindIR)); return Graph(std::make_shared<Graph::GraphData>(anf_graph, kMindIR));
} else if (model_type == kOM) { } else if (model_type == kOM) {
Buffer data = ReadFile(file); Buffer data = ReadFile(file);

Loading…
Cancel
Save