From cbf79298f73310fe4ca5d760ded73575e4bf8fad Mon Sep 17 00:00:00 2001 From: Idriss Chaouch Date: Fri, 8 Sep 2023 11:18:16 +0100 Subject: IVGCVSW-8037 Add BROADCAST_TO to tflite classic and opaque delegate. Signed-off-by: Idriss Chaouch Change-Id: Ibc145d0ea1ac9414b6a68b5b547bf2ea2852fd36 --- delegate/test/BroadcastToTest.cpp | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 delegate/test/BroadcastToTest.cpp (limited to 'delegate/test/BroadcastToTest.cpp') diff --git a/delegate/test/BroadcastToTest.cpp b/delegate/test/BroadcastToTest.cpp new file mode 100644 index 0000000000..f4692cfb07 --- /dev/null +++ b/delegate/test/BroadcastToTest.cpp @@ -0,0 +1,80 @@ +// +// Copyright © 2023 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "BroadcastToTestHelper.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace armnnDelegate +{ +template +void BroadcastToTest(std::vector &backends, tflite::TensorType inputTensorType) +{ + // Set input data + std::vector inputValues = { + 0, 1, 2, 3 + }; + // Set output data + std::vector expectedOutputValues = { + 0, 1, 2, 3, + 0, 1, 2, 3, + 0, 1, 2, 3 + }; + + // The shape data + const std::vector shapeData = {3, 4}; + + // Set shapes + const std::vector inputShape = {1, 4}; + const std::vector shapeShape = {2}; + const std::vector expectedOutputShape = {3, 4}; + + BroadcastToTestImpl(inputTensorType, + tflite::BuiltinOperator_BROADCAST_TO, + backends, + inputValues, + inputShape, + shapeShape, + shapeData, + expectedOutputValues, + expectedOutputShape); +} + +TEST_SUITE("BroadcastToTests_CpuRefTests") +{ + + TEST_CASE ("BroadcastTo_int_CpuRef_Test") + { + std::vector backends = {armnn::Compute::CpuRef}; + BroadcastToTest(backends, ::tflite::TensorType::TensorType_INT32); + } + + TEST_CASE ("BroadcastTo_Float32_CpuRef_Test") + { + std::vector backends = {armnn::Compute::CpuRef}; + BroadcastToTest(backends, ::tflite::TensorType::TensorType_FLOAT32); + } + + TEST_CASE ("BroadcastTo_Uint8_t_CpuRef_Test") + { + std::vector backends = {armnn::Compute::CpuRef}; + BroadcastToTest(backends, ::tflite::TensorType::TensorType_UINT8); + } + + TEST_CASE ("BroadcastTo_Int8_t_CpuRef_Test") + { + std::vector backends = {armnn::Compute::CpuRef}; + BroadcastToTest(backends, ::tflite::TensorType::TensorType_INT8); + } + +} // TEST_SUITE("BroadcastToTests_CpuRefTests") +} \ No newline at end of file -- cgit v1.2.1