diff options
author | Ryan OShea <ryan.oshea3@arm.com> | 2023-06-27 22:34:54 +0100 |
---|---|---|
committer | TeresaARM <teresa.charlinreyes@arm.com> | 2023-08-04 08:34:55 +0000 |
commit | c229b3fd81b42140c0fa8731e90bc07323cec794 (patch) | |
tree | 1962789e2810be81cd56a2084b0f7a962f0e4e38 /include/armnn/backends | |
parent | c377eb8305e6fdc0f4d00bb4766827fc3087bf25 (diff) | |
download | armnn-c229b3fd81b42140c0fa8731e90bc07323cec794.tar.gz |
IVGCVSW-7676 Audit the use of ARMNN_ASSERT
* Replace most ARMNN_ASSERT's from tflite parser
* Replace most ARMNN_ASSERT's from onnx parser
* Replace some ARMNN_ASSERT's from tflite delegate
* Replace some ARMNN_ASSERT;s from include files
Signed-off-by: Ryan OShea <ryan.oshea3@arm.com>
Change-Id: Ie052e0180060203f28f64ebf54acad298f431caf
Diffstat (limited to 'include/armnn/backends')
-rw-r--r-- | include/armnn/backends/Workload.hpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/include/armnn/backends/Workload.hpp b/include/armnn/backends/Workload.hpp index 9d5fec98cd..e0647c24d5 100644 --- a/include/armnn/backends/Workload.hpp +++ b/include/armnn/backends/Workload.hpp @@ -114,14 +114,16 @@ public: if (std::find(dataTypes.begin(), dataTypes.end(), expectedInputType) == dataTypes.end()) { - ARMNN_ASSERT_MSG(false, "Trying to create workload with incorrect type"); + throw armnn::Exception("Trying to create workload with incorrect type"); } - ARMNN_ASSERT_MSG(std::all_of(std::next(info.m_InputTensorInfos.begin()), + if (std::all_of(std::next(info.m_InputTensorInfos.begin()), info.m_InputTensorInfos.end(), [&](auto it){ return it.GetDataType() == expectedInputType; - }), - "Trying to create workload with incorrect type"); + }) == false) + { + throw armnn::Exception("Trying to create workload with incorrect type"); + } } armnn::DataType expectedOutputType; @@ -135,19 +137,21 @@ public: if (expectedOutputType != expectedInputType) { - ARMNN_ASSERT_MSG(false, "Trying to create workload with incorrect type"); + throw armnn::Exception( "Trying to create workload with incorrect type"); } } else if (std::find(dataTypes.begin(), dataTypes.end(), expectedOutputType) == dataTypes.end()) { - ARMNN_ASSERT_MSG(false, "Trying to create workload with incorrect type"); + throw armnn::Exception("Trying to create workload with incorrect type"); } - ARMNN_ASSERT_MSG(std::all_of(std::next(info.m_OutputTensorInfos.begin()), + if (std::all_of(std::next(info.m_OutputTensorInfos.begin()), info.m_OutputTensorInfos.end(), [&](auto it){ return it.GetDataType() == expectedOutputType; - }), - "Trying to create workload with incorrect type"); + }) == false) + { + throw armnn::Exception("Trying to create workload with incorrect type"); + } } } }; @@ -160,19 +164,22 @@ public: MultiTypedWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info) : BaseWorkload<QueueDescriptor>(descriptor, info) { - ARMNN_ASSERT_MSG(std::all_of(info.m_InputTensorInfos.begin(), + if (std::all_of(info.m_InputTensorInfos.begin(), info.m_InputTensorInfos.end(), [&](auto it){ return it.GetDataType() == InputDataType; - }), - "Trying to create workload with incorrect type"); - - ARMNN_ASSERT_MSG(std::all_of(info.m_OutputTensorInfos.begin(), + }) == false) + { + throw armnn::Exception("Trying to create workload with incorrect type"); + } + if (std::all_of(info.m_OutputTensorInfos.begin(), info.m_OutputTensorInfos.end(), [&](auto it){ return it.GetDataType() == OutputDataType; - }), - "Trying to create workload with incorrect type"); + }) == false) + { + throw armnn::Exception("Trying to create workload with incorrect type"); + } } }; @@ -187,16 +194,20 @@ public: { if (!info.m_InputTensorInfos.empty()) { - ARMNN_ASSERT_MSG(info.m_InputTensorInfos.front().GetDataType() == DataType, - "Trying to create workload with incorrect type"); + if (info.m_InputTensorInfos.front().GetDataType() != DataType) + { + throw armnn::Exception("Trying to create workload with incorrect type"); + } } - ARMNN_ASSERT_MSG(std::all_of(info.m_OutputTensorInfos.begin(), + if (std::all_of(info.m_OutputTensorInfos.begin(), info.m_OutputTensorInfos.end(), [&](auto it){ return it.GetDataType() == DataType; - }), - "Trying to create workload with incorrect type"); + }) == false) + { + throw armnn::Exception("Trying to create workload with incorrect type"); + } } }; |