Browse Source

!12531 error when loadmodel a unexist file

From: @zhoufeng54
Reviewed-by: @xu-yfei,@kisnwang
Signed-off-by: @xu-yfei
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 4 years ago
parent
commit
c09968160f
2 changed files with 4 additions and 6 deletions
  1. +1
    -0
      mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc
  2. +3
    -6
      mindspore/ccsrc/cxx_api/serialization.cc

+ 1
- 0
mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc View File

@@ -24,6 +24,7 @@
#include "backend/session/session_factory.h"
#include "backend/session/executor_manager.h"
#include "runtime/device/kernel_runtime_manager.h"
#include "runtime/dev.h"

namespace mindspore {
API_FACTORY_REG(GraphCell::GraphImpl, Ascend910, AscendGraphImpl);


+ 3
- 6
mindspore/ccsrc/cxx_api/serialization.cc View File

@@ -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) {
if (model_type == kMindIR) {
FuncGraphPtr anf_graph = nullptr;
try {
anf_graph = LoadMindIR(file);
} catch (const std::exception &) {
MS_LOG(EXCEPTION) << "Load MindIR failed.";
FuncGraphPtr anf_graph = LoadMindIR(file);
if (anf_graph == nullptr) {
MS_LOG(EXCEPTION) << "Load model failed.";
}

return Graph(std::make_shared<Graph::GraphData>(anf_graph, kMindIR));
} else if (model_type == kOM) {
Buffer data = ReadFile(file);


Loading…
Cancel
Save