diff options
Diffstat (limited to 'src/armnnTfLiteParser')
-rw-r--r-- | src/armnnTfLiteParser/TfLiteParser.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index 5070d5b22f..7c81a8f757 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -329,6 +329,11 @@ std::vector<unsigned int> AsUnsignedVector(const std::vector<int32_t> & in) result.reserve(in.size()); for (auto & i : in) { + // If the location of the input data is -1 then the input should be ignored. + if (i == -1) + { + continue; + } result.push_back(CHECKED_NON_NEGATIVE(i)); } return result; @@ -3359,11 +3364,19 @@ TfLiteParserImpl::TensorRawPtrVector TfLiteParserImpl::GetInputs(const ModelPtr const auto & operatorPtr = subgraphPtr->operators[operatorIndex]; size_t inputCount = operatorPtr->inputs.size(); - TensorRawPtrVector result(inputCount); + TensorRawPtrVector result; for (size_t i=0; i<inputCount; ++i) { - uint32_t inputId = CHECKED_NON_NEGATIVE(operatorPtr->inputs[i]); - result[i] = subgraphPtr->tensors[inputId].get(); + // If the input location is -1 then assume input is turned off. + if (operatorPtr->inputs[i] == -1) + { + continue; + } + else + { + uint32_t inputId = CHECKED_NON_NEGATIVE(operatorPtr->inputs[i]); + result.push_back(subgraphPtr->tensors[inputId].get()); + } } return result; } |