From 564c13dc098eb9353ac15e2609712ab8db9bf350 Mon Sep 17 00:00:00 2001 From: Idriss Chaouch Date: Fri, 1 Sep 2023 17:58:38 +0100 Subject: IVGCVSW-7525 Add broadcast_to to TFLite Parser * Changing the optimizer * Changing EndToEnd Tests Signed-off-by: Idriss Chaouch Signed-off-by: Narumol Prangnawarat Change-Id: Ib581794280322a39cfc5ea3c4e6a6398cf723d5e --- .../test/BroadcastToEndToEndTestImpl.hpp | 39 +++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src/backends/backendsCommon/test') diff --git a/src/backends/backendsCommon/test/BroadcastToEndToEndTestImpl.hpp b/src/backends/backendsCommon/test/BroadcastToEndToEndTestImpl.hpp index 3b2c47fb94..f9de3b928f 100644 --- a/src/backends/backendsCommon/test/BroadcastToEndToEndTestImpl.hpp +++ b/src/backends/backendsCommon/test/BroadcastToEndToEndTestImpl.hpp @@ -87,7 +87,8 @@ namespace } template > - void BroadcastToEndToEndElementWiseBinary(const std::vector& backends) + void BroadcastToEndToEndElementWiseBinary(const std::vector& backends, + const ElementwiseBinaryDescriptor& elementWiseDescriptor) { float qScale = 1.0f; int32_t qOffset = 0; @@ -114,17 +115,39 @@ namespace 1, 1, 1, 1 }, qScale, qOffset); - std::vector expectedOutputData = armnnUtils::QuantizedVector({ - 65, 144, 91, 161, - 65, 144, 91, 161, - 65, 144, 91, 161, - 65, 144, 91, 161 - }, qScale, qOffset); + std::vector expectedOutputData; + if (elementWiseDescriptor.m_Operation == BinaryOperation::Mul || + elementWiseDescriptor.m_Operation == BinaryOperation::Div) { + expectedOutputData = armnnUtils::QuantizedVector({ + 65, 144, 91, 161, + 65, 144, 91, 161, + 65, 144, 91, 161, + 65, 144, 91, 161 + }, qScale, qOffset); + } + else if (elementWiseDescriptor.m_Operation == BinaryOperation::Add) + { + expectedOutputData = armnnUtils::QuantizedVector({ + 66, 145, 92, 162, + 66, 145, 92, 162, + 66, 145, 92, 162, + 66, 145, 92, 162 + }, qScale, qOffset); + } + else if (elementWiseDescriptor.m_Operation == BinaryOperation::Sub) + { + expectedOutputData = armnnUtils::QuantizedVector({ + 64, 143, 90, 160, + 64, 143, 90, 160, + 64, 143, 90, 160, + 64, 143, 90, 160 + }, qScale, qOffset); + } auto descriptor = armnn::BroadcastToDescriptor(armnn::TensorShape({ 4, 4 })); CHECK(descriptor.m_BroadcastToShape == outputTensorShape); INetworkPtr network = CreateBroadcastToNetworkWithElementWiseBinary(descriptor, - BinaryOperation::Mul, + elementWiseDescriptor, inputInfo, inputInfoElementWise, outputInfo); -- cgit v1.2.1