aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2023-07-31 12:43:02 +0100
committermike.kelly <mike.kelly@arm.com>2023-08-01 13:15:59 +0000
commit60101b3eeccfafd1c9bada96674e4f0b167c7870 (patch)
tree88416af80958c7c99d3d48596345faac4f45c4e9
parentd73555063dcbeb7a6bac3261a90faef9e04a2a2d (diff)
downloadandroid-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.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/Utils.cpp b/Utils.cpp
index 13eb84d5..58356ac1 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -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);
}