From 60101b3eeccfafd1c9bada96674e4f0b167c7870 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Mon, 31 Jul 2023 12:43:02 +0100 Subject: 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 Change-Id: I72c116377276c8b7a4cd0db7f91eb911e697d420 --- Utils.cpp | 25 ++++++++++++------------- 1 file 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 dimensionsSpecificity(operand.dimensions.size(), true); - TensorShape tensorShape(operand.dimensions.size(), operand.dimensions.data(), dimensionsSpecificity); + for (unsigned int i = 0; i < static_cast(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(dimensionsSpecificity.data())); ret = TensorInfo(tensorShape, type); } -- cgit v1.2.1