diff options
author | Patryk Kaiser <patryk.kaiser@arm.com> | 2024-06-27 12:29:48 +0100 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2024-07-01 16:55:55 +0000 |
commit | 656285153399d96ead5925db907d0ec1961dfd76 (patch) | |
tree | 74ae6dbd3199c0297c0321d5998cfd546537af26 /delegate/common/src/test | |
parent | 443804adee542d4330713e8dda6357b9495856fa (diff) | |
download | armnn-656285153399d96ead5925db907d0ec1961dfd76.tar.gz |
IVGCVSW-8139 Fixing Broadcast OP DTS tests
* In ref broadcast layer added broadcast support to expand tensor shapes
* Added function to check for zero dimension tensors
* Added check for unsupported zero dimension tensors during broadcast
* Added DelegateUtils unit test file with unit tests for the new function
Signed-off-by: Patryk Kaiser <patryk.kaiser@arm.com>
Change-Id: If4e786f7ba580399e781c48335888e8da8458019
Diffstat (limited to 'delegate/common/src/test')
-rw-r--r-- | delegate/common/src/test/DelegateUtilsTest.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/delegate/common/src/test/DelegateUtilsTest.cpp b/delegate/common/src/test/DelegateUtilsTest.cpp new file mode 100644 index 0000000000..5ce470e289 --- /dev/null +++ b/delegate/common/src/test/DelegateUtilsTest.cpp @@ -0,0 +1,54 @@ +// +// Copyright © 2024 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include <armnn/Tensor.hpp> +#include <doctest/doctest.h> +#include <common/src/DelegateUtils.hpp> + +namespace armnn +{ + +TEST_SUITE("DelegateUtils_Tests") +{ + TEST_CASE("Zero_Dim_In_Input_Test_True") + { + unsigned int inputDimSizes[] = {0, 1, 2, 3}; + TensorInfo inputTensor = armnn::TensorInfo(4, inputDimSizes, DataType::Float32); + + CHECK(ZeroDimPresent({inputTensor}) == true); + } + + TEST_CASE("Zero_Dim_In_Input_Test_False") + { + unsigned int inputDimSizes[] = {1, 2, 3, 4}; + TensorInfo inputTensor = armnn::TensorInfo(4, inputDimSizes, DataType::Float32); + + CHECK(ZeroDimPresent({inputTensor}) == false); + } + + TEST_CASE("Zero_Dim_In_Output_Test_True") + { + unsigned int inputDimSizes[] = {1, 2, 3, 4}; + TensorInfo inputTensor = armnn::TensorInfo(4, inputDimSizes, DataType::Float32); + + unsigned int outputDimSizes[] = {0, 1, 2, 3}; + TensorInfo outputTensor = armnn::TensorInfo(4, outputDimSizes, DataType::Float32); + + CHECK(ZeroDimPresent({inputTensor, outputTensor}) == true); + } + + TEST_CASE("Zero_Dim_In_Output_Test_False") + { + unsigned int inputDimSizes[] = {1, 2, 3, 4}; + TensorInfo inputTensor = armnn::TensorInfo(4, inputDimSizes, DataType::Float32); + + unsigned int outputDimSizes[] = {1, 2, 3, 4}; + TensorInfo outputTensor = armnn::TensorInfo(4, outputDimSizes, DataType::Float32); + + CHECK(ZeroDimPresent({inputTensor, outputTensor}) == false); + } +} + +} // namespace armnn
\ No newline at end of file |