aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/Types.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/armnn/Types.hpp')
-rw-r--r--include/armnn/Types.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp
index b5a4266e36..880a6dd816 100644
--- a/include/armnn/Types.hpp
+++ b/include/armnn/Types.hpp
@@ -306,7 +306,21 @@ public:
PermutationVector(std::initializer_list<ValueType> dimMappings);
- ValueType operator[](SizeType i) const { return m_DimMappings.at(i); }
+ ///
+ /// Indexing method with out-of-bounds error checking for the m_DimMappings array.
+ /// @param i - integer value corresponding to index of m_DimMappings array to retrieve element from.
+ /// @return element at index i of m_DimMappings array.
+ /// @throws InvalidArgumentException when indexing out-of-bounds index of m_DimMappings array.
+ ///
+ ValueType operator[](SizeType i) const
+ {
+ if (i >= GetSize())
+ {
+ throw InvalidArgumentException("Invalid indexing of PermutationVector of size " + std::to_string(GetSize())
+ + " at location [" + std::to_string(i) + "].");
+ }
+ return m_DimMappings.at(i);
+ }
SizeType GetSize() const { return m_NumDimMappings; }