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 /delegate/classic/src/Split.hpp | |
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 'delegate/classic/src/Split.hpp')
-rw-r--r-- | delegate/classic/src/Split.hpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/delegate/classic/src/Split.hpp b/delegate/classic/src/Split.hpp index fcd901b23e..aaa610259f 100644 --- a/delegate/classic/src/Split.hpp +++ b/delegate/classic/src/Split.hpp @@ -44,7 +44,11 @@ TfLiteStatus VisitSplitOperator(DelegateData& delegateData, const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteInputTensor); - ARMNN_ASSERT(GetTensorInfoForTfLiteTensor(tfLiteAxisTensor).GetNumElements() == 1); + if (GetTensorInfoForTfLiteTensor(tfLiteAxisTensor).GetNumElements() != 1) + { + return kTfLiteError; + } + auto* axisTensorDataPtr = tflite::GetTensorData<int32_t>(&tfLiteAxisTensor); std::vector<int32_t> axisTensorData(axisTensorDataPtr, axisTensorDataPtr + 1); int32_t axis = axisTensorData[0]; @@ -183,8 +187,16 @@ TfLiteStatus VisitSplitVOperator(DelegateData& delegateData, const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteInputTensor); const armnn::TensorInfo& splitsTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteSplitsTensor); - ARMNN_ASSERT(splitsTensorInfo.GetNumDimensions() == 1); - ARMNN_ASSERT(GetTensorInfoForTfLiteTensor(tfLiteAxisTensor).GetNumElements() == 1); + + if (splitsTensorInfo.GetNumDimensions() != 1) + { + return kTfLiteError; + } + + if (GetTensorInfoForTfLiteTensor(tfLiteAxisTensor).GetNumElements() != 1) + { + return kTfLiteError; + } auto* axisTensorDataPtr = tflite::GetTensorData<int32_t>(&tfLiteAxisTensor); std::vector<int32_t> axisTensorData(axisTensorDataPtr, axisTensorDataPtr + 1); |