From 187b3a73e63f997b2d4215b6fb1477b55c9764f9 Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 19 Nov 2020 17:50:34 +0000 Subject: IVGCVSW-5548 Fix delegate ElementwiseUnary tests for CpuAcc/GpuAcc * Apply new test suite structure to be able to filter for backends For ElementwiseBinary and ElementwiseUnary * Add tolerance to data comparison Signed-off-by: Jan Eilers Change-Id: Iccabb68f316c93533e1076da5822ebc199e23739 --- delegate/src/test/ElementwiseUnaryTestHelper.hpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'delegate/src/test/ElementwiseUnaryTestHelper.hpp') diff --git a/delegate/src/test/ElementwiseUnaryTestHelper.hpp b/delegate/src/test/ElementwiseUnaryTestHelper.hpp index b4a55cbe99..348c8abcef 100644 --- a/delegate/src/test/ElementwiseUnaryTestHelper.hpp +++ b/delegate/src/test/ElementwiseUnaryTestHelper.hpp @@ -5,6 +5,8 @@ #pragma once +#include "TestUtils.hpp" + #include #include @@ -79,7 +81,7 @@ void ElementwiseUnaryFP32Test(tflite::BuiltinOperator unaryOperatorCode, std::vector& expectedOutputValues) { using namespace tflite; - const std::vector inputShape { { 3, 1, 2} }; + std::vector inputShape { { 3, 1, 2} }; std::vector modelBuffer = CreateElementwiseUnaryTfLiteModel(unaryOperatorCode, ::tflite::TensorType_FLOAT32, inputShape); @@ -126,15 +128,7 @@ void ElementwiseUnaryFP32Test(tflite::BuiltinOperator unaryOperatorCode, CHECK(armnnDelegateInterpreter->Invoke() == kTfLiteOk); // Compare output data - auto tfLiteDelegateOutputId = tfLiteInterpreter->outputs()[0]; - auto tfLiteDelageOutputData = tfLiteInterpreter->typed_tensor(tfLiteDelegateOutputId); - auto armnnDelegateOutputId = armnnDelegateInterpreter->outputs()[0]; - auto armnnDelegateOutputData = armnnDelegateInterpreter->typed_tensor(armnnDelegateOutputId); - for (size_t i = 0; i < inputValues.size(); i++) - { - CHECK(expectedOutputValues[i] == armnnDelegateOutputData[i]); - CHECK(tfLiteDelageOutputData[i] == armnnDelegateOutputData[i]); - } + armnnDelegate::CompareOutputData(tfLiteInterpreter, armnnDelegateInterpreter, inputShape, expectedOutputValues); } } // anonymous namespace -- cgit v1.2.1