aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/test/ElementwiseUnaryTestHelper.hpp
diff options
context:
space:
mode:
authorJan Eilers <jan.eilers@arm.com>2020-11-19 17:50:34 +0000
committerJim Flynn <jim.flynn@arm.com>2020-11-19 23:47:39 +0000
commit187b3a73e63f997b2d4215b6fb1477b55c9764f9 (patch)
tree5ed6905adb426381fd5351337a64d6a03c5937b1 /delegate/src/test/ElementwiseUnaryTestHelper.hpp
parent58f8ecdbcc7630c56935d1c9640d4eb12daa6bfd (diff)
downloadarmnn-187b3a73e63f997b2d4215b6fb1477b55c9764f9.tar.gz
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 <jan.eilers@arm.com> Change-Id: Iccabb68f316c93533e1076da5822ebc199e23739
Diffstat (limited to 'delegate/src/test/ElementwiseUnaryTestHelper.hpp')
-rw-r--r--delegate/src/test/ElementwiseUnaryTestHelper.hpp14
1 files changed, 4 insertions, 10 deletions
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 <armnn_delegate.hpp>
#include <flatbuffers/flatbuffers.h>
@@ -79,7 +81,7 @@ void ElementwiseUnaryFP32Test(tflite::BuiltinOperator unaryOperatorCode,
std::vector<float>& expectedOutputValues)
{
using namespace tflite;
- const std::vector<int32_t> inputShape { { 3, 1, 2} };
+ std::vector<int32_t> inputShape { { 3, 1, 2} };
std::vector<char> 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<float>(tfLiteDelegateOutputId);
- auto armnnDelegateOutputId = armnnDelegateInterpreter->outputs()[0];
- auto armnnDelegateOutputData = armnnDelegateInterpreter->typed_tensor<float>(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