aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/DelegateUtils.hpp
diff options
context:
space:
mode:
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