From 1342bed114effa8b183ba683189117cd730ab635 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 17 Nov 2021 15:01:00 +0000 Subject: 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 Change-Id: I94d2bffdb82a0592943f497d4f57972151d9f2db --- src/backends/backendsCommon/TensorHandle.hpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/backends/backendsCommon') 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 -#include +#include #include @@ -30,8 +30,14 @@ public: template const T* GetConstTensor() const { - ARMNN_ASSERT(CompatibleTypes(GetTensorInfo().GetDataType())); - return reinterpret_cast(m_Memory); + if (armnnUtils::CompatibleTypes(GetTensorInfo().GetDataType())) + { + return reinterpret_cast(m_Memory); + } + else + { + throw armnn::Exception("Attempting to get not compatible type tensor!"); + } } const TensorInfo& GetTensorInfo() const @@ -79,8 +85,14 @@ public: template T* GetTensor() const { - ARMNN_ASSERT(CompatibleTypes(GetTensorInfo().GetDataType())); - return reinterpret_cast(m_MutableMemory); + if (armnnUtils::CompatibleTypes(GetTensorInfo().GetDataType())) + { + return reinterpret_cast(m_MutableMemory); + } + else + { + throw armnn::Exception("Attempting to get not compatible type tensor!"); + } } protected: -- cgit v1.2.1