diff options
author | Finn Williams <Finn.Williams@Arm.com> | 2020-08-19 22:54:00 +0100 |
---|---|---|
committer | TeresaARM <teresa.charlinreyes@arm.com> | 2020-08-20 15:44:05 +0000 |
commit | 291a16b28522c75e1f44cb37f6b61585320da215 (patch) | |
tree | 496d97f713b3897e2b2b325be7a7ff92ec9f7bb1 /ModelToINetworkConverter.cpp | |
parent | 81f27fdb53511c8f377ca2d82fc8436ebf675e76 (diff) | |
download | android-nn-driver-291a16b28522c75e1f44cb37f6b61585320da215.tar.gz |
IVGCVSW-5220 Set all operations to unsupported after encountering an unsupported operation with with dynamic inputs
Change-Id: Ia30698d608810dabb419d7d326ad985789d50603
Signed-off-by: Finn Williams <Finn.Williams@Arm.com>
Diffstat (limited to 'ModelToINetworkConverter.cpp')
-rw-r--r-- | ModelToINetworkConverter.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/ModelToINetworkConverter.cpp b/ModelToINetworkConverter.cpp index 0d6ddc34..e8cf8a8b 100644 --- a/ModelToINetworkConverter.cpp +++ b/ModelToINetworkConverter.cpp @@ -110,7 +110,7 @@ void ModelToINetworkConverter<HalPolicy>::Convert() Fail("%s: Failed to convert input operand to TensorShape: %s", __func__, e.what()); m_ConversionResult = ConversionResult::UnsupportedFeature; } - + bool UnsupportedDynamicOperation = false; for (uint32_t operationIdx = 0; operationIdx < getMainModel(m_Model).operations.size(); operationIdx++) { const auto& operation = getMainModel(m_Model).operations[operationIdx]; @@ -147,9 +147,33 @@ void ModelToINetworkConverter<HalPolicy>::Convert() // We still need to continue and check the other ones. if (!ok) { + if (m_Data.m_DynamicInputsEncountered) + { + Fail("%s: The unsupported operation at index %i has dynamic inputs.", __func__, operationIdx); + UnsupportedDynamicOperation = true; + } + m_ConversionResult = ConversionResult::UnsupportedFeature; } + m_Data.m_DynamicInputsEncountered = false; } + + // Due to the NNAPI partitioner not supporting partition boundaries of unknown size, + // any operations who's outputs connect to an unsupported operation with with dynamic inputs + // will cause a failure. + + // The simplest solution to this problem is to not support any operations in a model containing + // an unsupported operation with with dynamic inputs. + if (UnsupportedDynamicOperation) + { + Fail("%s: Unsupported operation with dynamic inputs found. Retroactively setting all operations to unsupported", + __func__); + for (auto& operation : m_OperationSupported) + { + operation.second = false; + } + } + try { if (m_ConversionResult == ConversionResult::Success) |