diff options
author | Mike Kelly <mike.kelly@arm.com> | 2023-07-31 12:43:02 +0100 |
---|---|---|
committer | mike.kelly <mike.kelly@arm.com> | 2023-08-01 13:15:59 +0000 |
commit | 60101b3eeccfafd1c9bada96674e4f0b167c7870 (patch) | |
tree | 88416af80958c7c99d3d48596345faac4f45c4e9 | |
parent | d73555063dcbeb7a6bac3261a90faef9e04a2a2d (diff) | |
download | android-nn-driver-60101b3eeccfafd1c9bada96674e4f0b167c7870.tar.gz |
IVGCVSW-7899 Cannot handle tensors with more than 5 dimensions
* Fixed issue where then dimensions specificity didn't match the number
of dimensions.
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I72c116377276c8b7a4cd0db7f91eb911e697d420
-rw-r--r-- | Utils.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -100,20 +100,19 @@ armnn::TensorInfo GetTensorInfoForOperand(const V1_0::Operand& operand) } else { - bool dimensionsSpecificity[5] = { true, true, true, true, true }; - int count = 0; - std::for_each(operand.dimensions.data(), - operand.dimensions.data() + operand.dimensions.size(), - [&](const unsigned int val) - { - if (val == 0) - { - dimensionsSpecificity[count] = false; - } - count++; - }); + std::vector<unsigned char> dimensionsSpecificity(operand.dimensions.size(), true); - TensorShape tensorShape(operand.dimensions.size(), operand.dimensions.data(), dimensionsSpecificity); + for (unsigned int i = 0; i < static_cast<unsigned int>(operand.dimensions.size()); ++i) + { + auto dim = operand.dimensions[i]; + if (dim == 0) + { + dimensionsSpecificity[i] = false; + } + } + TensorShape tensorShape(operand.dimensions.size(), + operand.dimensions.data(), + reinterpret_cast<const bool *>(dimensionsSpecificity.data())); ret = TensorInfo(tensorShape, type); } |