aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/test
diff options
context:
space:
mode:
authorDavid Monahan <david.monahan@arm.com>2023-01-12 14:53:34 +0000
committerDavid Monahan <david.monahan@arm.com>2023-01-13 11:28:52 +0000
commitd7fca093be53b314e100e15a8fa080cb506b60a3 (patch)
treefaf4adbdd3154ffa6101bcbbf8c4839179ad180b /src/backends/backendsCommon/test
parentc17a35f4b016c223add511a148ed3bb741770593 (diff)
downloadarmnn-d7fca093be53b314e100e15a8fa080cb506b60a3.tar.gz
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 <david.monahan@arm.com> Change-Id: I3eaa9c684647ead61520a563815581aa68bee51b
Diffstat (limited to 'src/backends/backendsCommon/test')
-rw-r--r--src/backends/backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp31
1 files changed, 26 insertions, 5 deletions
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<armnn::DataType ArmnnInType,
typename TInput = armnn::ResolveType<ArmnnInType>>
void ElementwiseUnarySimpleEndToEnd(const std::vector<BackendId>& backends,
- UnaryOperation operation,
- const std::vector<float> expectedOutput)
+ UnaryOperation operation)
{
using namespace armnn;
@@ -63,8 +62,30 @@ void ElementwiseUnarySimpleEndToEnd(const std::vector<BackendId>& backends,
CHECK(net);
- const std::vector<float> input({ 1, -1, 1, 1, 5, -5, 5, 5,
- -3, 3, 3, 3, 4, 4, -4, 4 });
+ std::vector<float> input;
+ std::vector<float> 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<TInput> qInputData = armnnUtils::QuantizedVector<TInput>(input, qScale, qOffset);