aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/DelegateUtils.hpp
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2021-04-18 16:40:00 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2021-04-19 10:33:02 +0100
commitd30bfb5754501c8e7db2bd6b6d6d1f46768bb6b4 (patch)
tree3eb79ceb47b3d955099fd2ee16725aeb708c0cad /delegate/src/DelegateUtils.hpp
parent6dd178f2395b34cfb360eabb0130c19ed258f5fa (diff)
downloadarmnn-d30bfb5754501c8e7db2bd6b6d6d1f46768bb6b4.tar.gz
IVGCVSW-5829 Segfault in TfLiteDelegate
* Updated Split function to read correct axis data. * Improved validation in Split and SplitV function. * Moved ComputeWrappedIndex function to DelegateUtils.hpp. Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: I8c7d0c9b747d1ab548df98da930d838c2f57659e
Diffstat (limited to 'delegate/src/DelegateUtils.hpp')
-rw-r--r--delegate/src/DelegateUtils.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/delegate/src/DelegateUtils.hpp b/delegate/src/DelegateUtils.hpp
index 1e5782ec42..deed61dc5f 100644
--- a/delegate/src/DelegateUtils.hpp
+++ b/delegate/src/DelegateUtils.hpp
@@ -554,4 +554,14 @@ TfLiteStatus ConnectConstant(armnn::IConnectableLayer* layer,
return kTfLiteOk;
}
+unsigned int ComputeWrappedIndex(int index, unsigned int numDimensions)
+{
+ int numDims = armnn::numeric_cast<int>(numDimensions);
+ int wrappedIndex = index < 0 ? numDims + index : index;
+ ARMNN_ASSERT(wrappedIndex >= 0);
+ ARMNN_ASSERT(wrappedIndex < numDims);
+
+ return static_cast<unsigned int>(wrappedIndex);
+};
+
} // namespace anonymous