diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-02-21 15:45:03 +0000 |
---|---|---|
committer | Aron Virginas-Tar <aron.virginas-tar@arm.com> | 2019-02-22 10:10:52 +0000 |
commit | 06e25c41e8727cc859c2b6d1988a988e90bb537b (patch) | |
tree | 4d367417232322b18a824b59f9accab623f880dc /include/armnn/Tensor.hpp | |
parent | 8ddae33ada66cc2ecdc0cde7799d81dda7532fb5 (diff) | |
download | armnn-06e25c41e8727cc859c2b6d1988a988e90bb537b.tar.gz |
IVGCVSW-2749 Throw exception in TensorShape when requested index >= number of dimensions
Change-Id: I3589b1e901b0f81f6bb17848046a22829f91bb9e
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Diffstat (limited to 'include/armnn/Tensor.hpp')
-rw-r--r-- | include/armnn/Tensor.hpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/include/armnn/Tensor.hpp b/include/armnn/Tensor.hpp index f4d7f9f984..9380a96af1 100644 --- a/include/armnn/Tensor.hpp +++ b/include/armnn/Tensor.hpp @@ -31,15 +31,9 @@ public: TensorShape& operator=(const TensorShape& other); - unsigned int operator[](unsigned int i) const - { - return m_Dimensions.at(i); - } + unsigned int operator[](unsigned int i) const; - unsigned int& operator[](unsigned int i) - { - return m_Dimensions.at(i); - } + unsigned int& operator[](unsigned int i); bool operator==(const TensorShape& other) const; bool operator!=(const TensorShape& other) const; @@ -50,6 +44,8 @@ public: private: std::array<unsigned int, MaxNumOfTensorDimensions> m_Dimensions; unsigned int m_NumDimensions; + + void CheckDimensionIndex(unsigned int i) const; }; class TensorInfo |