From d7fca093be53b314e100e15a8fa080cb506b60a3 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Thu, 12 Jan 2023 14:53:34 +0000 Subject: IVGCVSW-7173 Add Rsqrt to Tosa Ref Backend * Added ElementwiseUnary support with a mapping for Rsqrt * Added unittests * Added Rsqrt EndtoEnd tests for all backends * Changed TosaRefLayerSupport to default to false on unsupported layers Signed-off-by: David Monahan Change-Id: I3eaa9c684647ead61520a563815581aa68bee51b --- .../test/ElementwiseUnaryEndToEndTestImpl.hpp | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src/backends/backendsCommon') diff --git a/src/backends/backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp b/src/backends/backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp index 3f530ccb15..9586417407 100644 --- a/src/backends/backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp +++ b/src/backends/backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2020-2021, 2023 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once @@ -47,8 +47,7 @@ INetworkPtr CreateElementwiseUnaryNetwork(const TensorShape& inputShape, template> void ElementwiseUnarySimpleEndToEnd(const std::vector& backends, - UnaryOperation operation, - const std::vector expectedOutput) + UnaryOperation operation) { using namespace armnn; @@ -63,8 +62,30 @@ void ElementwiseUnarySimpleEndToEnd(const std::vector& backends, CHECK(net); - const std::vector input({ 1, -1, 1, 1, 5, -5, 5, 5, - -3, 3, 3, 3, 4, 4, -4, 4 }); + std::vector input; + std::vector expectedOutput; + switch(operation) + { + case UnaryOperation::Abs: + input = { 1, -1, 1, 1, 5, -5, 5, 5, + -3, 3, 3, 3, 4, 4, -4, 4 }; + expectedOutput = { 1.f, 1.f, 1.f, 1.f, 5.f, 5.f, 5.f, 5.f, + 3.f, 3.f, 3.f, 3.f, 4.f, 4.f, 4.f, 4.f }; + break; + case UnaryOperation::Rsqrt: + input = { 1, 1, 1, 1, 5, 5, 5, 5, + 3, 3, 3, 3, 4, 4, 4, 4 }; + expectedOutput = { 1.f, 1.f, 1.f, 1.f, 0.447214f, 0.447214f, 0.447214f, 0.447214f, + 0.57735f, 0.57735f, 0.57735f, 0.57735f, 0.5f, 0.5f, 0.5f, 0.5f }; + break; + default: + input = { 1, -1, 1, 1, 5, -5, 5, 5, + -3, 3, 3, 3, 4, 4, -4, 4 }; + expectedOutput = { 1.f, 1.f, 1.f, 1.f, 5.f, 5.f, 5.f, 5.f, + 3.f, 3.f, 3.f, 3.f, 4.f, 4.f, 4.f, 4.f }; + break; + } + // quantize data std::vector qInputData = armnnUtils::QuantizedVector(input, qScale, qOffset); -- cgit v1.2.1