aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/TensorHandle.hpp
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2021-11-17 15:01:00 +0000
committerSadik Armagan <sadik.armagan@arm.com>2021-11-18 16:43:17 +0000
commit1342bed114effa8b183ba683189117cd730ab635 (patch)
tree8561e8eceb6043d74a0c69197de62fcbd3d8dd8e /src/backends/backendsCommon/TensorHandle.hpp
parentf9de771083f1f32393b0fe5a3bcdedf4c148be15 (diff)
downloadarmnn-1342bed114effa8b183ba683189117cd730ab635.tar.gz
IVGCVSW-6452 'Move CompatibleTypes.hpp to the armnnUtils library'
* Moved CompatibleTypes.hpp to include folder * Added implementation file to source CompatibleTypes.cpp Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I94d2bffdb82a0592943f497d4f57972151d9f2db
Diffstat (limited to 'src/backends/backendsCommon/TensorHandle.hpp')
-rw-r--r--src/backends/backendsCommon/TensorHandle.hpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/backends/backendsCommon/TensorHandle.hpp b/src/backends/backendsCommon/TensorHandle.hpp
index b898bd11a5..ba1fc16378 100644
--- a/src/backends/backendsCommon/TensorHandle.hpp
+++ b/src/backends/backendsCommon/TensorHandle.hpp
@@ -10,7 +10,7 @@
#include <armnn/TypesUtils.hpp>
-#include <CompatibleTypes.hpp>
+#include <armnnUtils/CompatibleTypes.hpp>
#include <algorithm>
@@ -30,8 +30,14 @@ public:
template <typename T>
const T* GetConstTensor() const
{
- ARMNN_ASSERT(CompatibleTypes<T>(GetTensorInfo().GetDataType()));
- return reinterpret_cast<const T*>(m_Memory);
+ if (armnnUtils::CompatibleTypes<T>(GetTensorInfo().GetDataType()))
+ {
+ return reinterpret_cast<const T*>(m_Memory);
+ }
+ else
+ {
+ throw armnn::Exception("Attempting to get not compatible type tensor!");
+ }
}
const TensorInfo& GetTensorInfo() const
@@ -79,8 +85,14 @@ public:
template <typename T>
T* GetTensor() const
{
- ARMNN_ASSERT(CompatibleTypes<T>(GetTensorInfo().GetDataType()));
- return reinterpret_cast<T*>(m_MutableMemory);
+ if (armnnUtils::CompatibleTypes<T>(GetTensorInfo().GetDataType()))
+ {
+ return reinterpret_cast<T*>(m_MutableMemory);
+ }
+ else
+ {
+ throw armnn::Exception("Attempting to get not compatible type tensor!");
+ }
}
protected: