diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-08-02 11:38:42 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:16:42 +0100 |
commit | e3bc5c9e31e75dff384df82246ecbc952afebc9a (patch) | |
tree | c00e316031325e444a1983981270cc89dc363d5d /tests/validation | |
parent | 3ce3ff4e7133942e75fceae8f317104644d88bea (diff) | |
download | ComputeLibrary-e3bc5c9e31e75dff384df82246ecbc952afebc9a.tar.gz |
COMPMID-417: Fix (old) validation Tensor
Change-Id: I6fe64663801d4862483582a59b417bbe606d3f03
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/82485
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/validation')
-rw-r--r-- | tests/validation/Tensor.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/validation/Tensor.h b/tests/validation/Tensor.h index 81066b40ad..34d8cd72cc 100644 --- a/tests/validation/Tensor.h +++ b/tests/validation/Tensor.h @@ -55,12 +55,18 @@ public: T &operator[](size_t offset) { + ARM_COMPUTE_ERROR_ON(_ptr == nullptr); + return _ptr[offset]; } const T &operator[](size_t offset) const { - return _ptr_const[offset]; + const T *ptr = (_ptr_const != nullptr) ? _ptr_const : _ptr; + + ARM_COMPUTE_ERROR_ON(ptr == nullptr); + + return ptr[offset]; } int num_elements() const @@ -85,14 +91,15 @@ public: const T *data() const { - return (_ptr != nullptr) ? _ptr : _ptr_const; + return (_ptr_const != nullptr) ? _ptr_const : _ptr; } + T *data() { return _ptr; } - const T *data_const() + const T *data_const() const { return _ptr_const; } |