diff options
author | Jan Eilers <jan.eilers@arm.com> | 2020-11-19 17:50:34 +0000 |
---|---|---|
committer | Francis Murtagh <francis.murtagh@arm.com> | 2020-11-20 10:25:13 +0000 |
commit | c001e14fb6267acefd6325719d9b5cb997eebe5b (patch) | |
tree | 9be108a92418f0fd93d7e570bd1f4c319d5496fb /delegate/src/test/ElementwiseUnaryTestHelper.hpp | |
parent | b33f28b8e362a8b36fbb03ea62cce1de338ae126 (diff) | |
download | armnn-c001e14fb6267acefd6325719d9b5cb997eebe5b.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.hpp | 14 |
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 |