aboutsummaryrefslogtreecommitdiff
path: root/include/armnnUtils
diff options
context:
space:
mode:
authorRyan OShea <ryan.oshea3@arm.com>2023-06-27 22:34:54 +0100
committerTeresaARM <teresa.charlinreyes@arm.com>2023-08-04 08:34:55 +0000
commitc229b3fd81b42140c0fa8731e90bc07323cec794 (patch)
tree1962789e2810be81cd56a2084b0f7a962f0e4e38 /include/armnnUtils
parentc377eb8305e6fdc0f4d00bb4766827fc3087bf25 (diff)
downloadarmnn-c229b3fd81b42140c0fa8731e90bc07323cec794.tar.gz
IVGCVSW-7676 Audit the use of ARMNN_ASSERT
* Replace most ARMNN_ASSERT's from tflite parser * Replace most ARMNN_ASSERT's from onnx parser * Replace some ARMNN_ASSERT's from tflite delegate * Replace some ARMNN_ASSERT;s from include files Signed-off-by: Ryan OShea <ryan.oshea3@arm.com> Change-Id: Ie052e0180060203f28f64ebf54acad298f431caf
Diffstat (limited to 'include/armnnUtils')
-rw-r--r--include/armnnUtils/DataLayoutIndexed.hpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/include/armnnUtils/DataLayoutIndexed.hpp b/include/armnnUtils/DataLayoutIndexed.hpp
index 163d34b159..e57cec531f 100644
--- a/include/armnnUtils/DataLayoutIndexed.hpp
+++ b/include/armnnUtils/DataLayoutIndexed.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2018-2021,2023 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -29,13 +29,26 @@ public:
unsigned int batchIndex, unsigned int channelIndex,
unsigned int heightIndex, unsigned int widthIndex) const
{
- ARMNN_ASSERT( batchIndex < shape[0] || ( shape[0] == 0 && batchIndex == 0 ) );
- ARMNN_ASSERT( channelIndex < shape[m_ChannelsIndex] ||
- ( shape[m_ChannelsIndex] == 0 && channelIndex == 0) );
- ARMNN_ASSERT( heightIndex < shape[m_HeightIndex] ||
- ( shape[m_HeightIndex] == 0 && heightIndex == 0) );
- ARMNN_ASSERT( widthIndex < shape[m_WidthIndex] ||
- ( shape[m_WidthIndex] == 0 && widthIndex == 0) );
+ if (batchIndex >= shape[0] && !( shape[0] == 0 && batchIndex == 0))
+ {
+ throw armnn::Exception("Unable to get batch index", CHECK_LOCATION());
+ }
+ if (channelIndex >= shape[m_ChannelsIndex] &&
+ !(shape[m_ChannelsIndex] == 0 && channelIndex == 0))
+ {
+ throw armnn::Exception("Unable to get channel index", CHECK_LOCATION());
+
+ }
+ if (heightIndex >= shape[m_HeightIndex] &&
+ !( shape[m_HeightIndex] == 0 && heightIndex == 0))
+ {
+ throw armnn::Exception("Unable to get height index", CHECK_LOCATION());
+ }
+ if (widthIndex >= shape[m_WidthIndex] &&
+ ( shape[m_WidthIndex] == 0 && widthIndex == 0))
+ {
+ throw armnn::Exception("Unable to get width index", CHECK_LOCATION());
+ }
/// Offset the given indices appropriately depending on the data layout
switch (m_DataLayout)