aboutsummaryrefslogtreecommitdiff
path: root/delegate/test/NormalizationTestHelper.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'delegate/test/NormalizationTestHelper.hpp')
-rw-r--r--delegate/test/NormalizationTestHelper.hpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/delegate/test/NormalizationTestHelper.hpp b/delegate/test/NormalizationTestHelper.hpp
index d7930d91b9..1306fd199a 100644
--- a/delegate/test/NormalizationTestHelper.hpp
+++ b/delegate/test/NormalizationTestHelper.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2021, 2023 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2021, 2023-2024 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -10,12 +10,8 @@
#include <armnn_delegate.hpp>
#include <DelegateTestInterpreter.hpp>
-#include <flatbuffers/flatbuffers.h>
-#include <tensorflow/lite/kernels/register.h>
#include <tensorflow/lite/version.h>
-#include <doctest/doctest.h>
-
namespace
{
@@ -117,11 +113,11 @@ std::vector<char> CreateNormalizationTfLiteModel(tflite::BuiltinOperator normali
template <typename T>
void NormalizationTest(tflite::BuiltinOperator normalizationOperatorCode,
tflite::TensorType tensorType,
- const std::vector<armnn::BackendId>& backends,
const std::vector<int32_t>& inputShape,
std::vector<int32_t>& outputShape,
std::vector<T>& inputValues,
std::vector<T>& expectedOutputValues,
+ const std::vector<armnn::BackendId>& backends = {},
int32_t radius = 0,
float bias = 0.f,
float alpha = 0.f,
@@ -150,7 +146,7 @@ void NormalizationTest(tflite::BuiltinOperator normalizationOperatorCode,
std::vector<int32_t> tfLiteOutputShape = tfLiteInterpreter.GetOutputShape(0);
// Setup interpreter with Arm NN Delegate applied.
- auto armnnInterpreter = DelegateTestInterpreter(modelBuffer, backends);
+ auto armnnInterpreter = DelegateTestInterpreter(modelBuffer, CaptureAvailableBackends(backends));
CHECK(armnnInterpreter.AllocateTensors() == kTfLiteOk);
CHECK(armnnInterpreter.FillInputTensor<T>(inputValues, 0) == kTfLiteOk);
CHECK(armnnInterpreter.Invoke() == kTfLiteOk);
@@ -164,7 +160,7 @@ void NormalizationTest(tflite::BuiltinOperator normalizationOperatorCode,
armnnInterpreter.Cleanup();
}
-void L2NormalizationTest(std::vector<armnn::BackendId>& backends)
+void L2NormalizationTest(const std::vector<armnn::BackendId>& backends = {})
{
// Set input data
std::vector<int32_t> inputShape { 1, 1, 1, 10 };
@@ -201,18 +197,18 @@ void L2NormalizationTest(std::vector<armnn::BackendId>& backends)
NormalizationTest<float>(tflite::BuiltinOperator_L2_NORMALIZATION,
::tflite::TensorType_FLOAT32,
- backends,
inputShape,
outputShape,
inputValues,
- expectedOutputValues);
+ expectedOutputValues,
+ backends);
}
-void LocalResponseNormalizationTest(std::vector<armnn::BackendId>& backends,
- int32_t radius,
+void LocalResponseNormalizationTest(int32_t radius,
float bias,
float alpha,
- float beta)
+ float beta,
+ const std::vector<armnn::BackendId>& backends = {})
{
// Set input data
std::vector<int32_t> inputShape { 2, 2, 2, 1 };
@@ -234,11 +230,11 @@ void LocalResponseNormalizationTest(std::vector<armnn::BackendId>& backends,
NormalizationTest<float>(tflite::BuiltinOperator_LOCAL_RESPONSE_NORMALIZATION,
::tflite::TensorType_FLOAT32,
- backends,
inputShape,
outputShape,
inputValues,
expectedOutputValues,
+ backends,
radius,
bias,
alpha,