Browse Source

model input and output check

pull/15292/head
ling 4 years ago
parent
commit
1ebf0943d0
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      mindspore/lite/src/lite_model.cc

+ 7
- 0
mindspore/lite/src/lite_model.cc View File

@@ -23,6 +23,7 @@
#include <unordered_map> #include <unordered_map>
#include <memory> #include <memory>
#include "src/common/prim_util.h" #include "src/common/prim_util.h"
#include "src/common/graph_util.h"
#ifdef ENABLE_V0 #ifdef ENABLE_V0
#include "src/ops/compat/compat_register.h" #include "src/ops/compat/compat_register.h"
#endif #endif
@@ -219,6 +220,12 @@ int LiteModel::SubGraphVerify() const {
auto tensor_size = this->all_tensors_.size(); auto tensor_size = this->all_tensors_.size();
auto node_size = this->all_nodes_.size(); auto node_size = this->all_nodes_.size();


if (sub_graphs_[0]->input_indices_.size() == 0 || GetGraphInputNodes(this).size() == 0 ||
sub_graphs_[0]->output_indices_.size() == 0 || GetGraphOutputNodes(this).size() == 0) {
MS_LOG(ERROR) << "The model has invalid input and output, please check";
return RET_ERROR;
}

for (auto &graph : this->sub_graphs_) { for (auto &graph : this->sub_graphs_) {
if (graph == nullptr) { if (graph == nullptr) {
MS_LOG(ERROR) << "graph is null."; MS_LOG(ERROR) << "graph is null.";


Loading…
Cancel
Save