forked from mindspore-Ecosystem/mindspore
!24447 [MS][LITE]fix bug of tflite model verify
Merge pull request !24447 from mengyuanli/check_third_party_model2
This commit is contained in:
commit
11fe8954c5
|
@ -66,6 +66,10 @@ STATUS TfliteModelParser::TfliteModelVerify() {
|
||||||
|
|
||||||
for (auto &subgraph : tflite_model_->subgraphs) {
|
for (auto &subgraph : tflite_model_->subgraphs) {
|
||||||
auto all_singraph_tensor_size = subgraph->tensors.size();
|
auto all_singraph_tensor_size = subgraph->tensors.size();
|
||||||
|
if (subgraph->inputs.empty() || subgraph->outputs.empty()) {
|
||||||
|
MS_LOG(ERROR) << "tflite subgraph inputs or outputs is empty.";
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
if (std::any_of(subgraph->inputs.begin(), subgraph->inputs.end(), [&all_singraph_tensor_size](int32_t index) {
|
if (std::any_of(subgraph->inputs.begin(), subgraph->inputs.end(), [&all_singraph_tensor_size](int32_t index) {
|
||||||
return index >= static_cast<int32_t>(all_singraph_tensor_size) || index < 0;
|
return index >= static_cast<int32_t>(all_singraph_tensor_size) || index < 0;
|
||||||
})) {
|
})) {
|
||||||
|
|
Loading…
Reference in New Issue