aboutsummaryrefslogtreecommitdiff
path: root/tests/validation_new
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-07-19 10:18:42 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commit6db73ce5222d4b27b06c4e4aa9e466ceb9a09ba2 (patch)
treed8649ef21112bd68936904a2008ada1360472320 /tests/validation_new
parentafde732eb016f18c781923cf1e6c9edf68f586f7 (diff)
downloadComputeLibrary-6db73ce5222d4b27b06c4e4aa9e466ceb9a09ba2.tar.gz
COMPMID-415: Move NormalizationLayer to new validation
Change-Id: Icf5781c920836fe87d2db27ca3f9cc4eb2bea554 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80999 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation_new')
-rw-r--r--tests/validation_new/CPP/NormalizationLayer.cpp274
-rw-r--r--tests/validation_new/CPP/NormalizationLayer.h47
-rw-r--r--tests/validation_new/NEON/NormalizationLayer.cpp125
-rw-r--r--tests/validation_new/fixtures/NormalizationLayerFixture.h133
4 files changed, 579 insertions, 0 deletions
diff --git a/tests/validation_new/CPP/NormalizationLayer.cpp b/tests/validation_new/CPP/NormalizationLayer.cpp
new file mode 100644
index 0000000000..72f49007cc
--- /dev/null
+++ b/tests/validation_new/CPP/NormalizationLayer.cpp
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "NormalizationLayer.h"
+
+#include "tests/validation_new/FixedPoint.h"
+#include "tests/validation_new/half.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type>
+SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info)
+{
+ // Create reference
+ SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
+
+ // Compute reference
+ const uint32_t norm_size = info.norm_size();
+ NormType type = info.type();
+ float beta = info.beta();
+ uint32_t kappa = info.kappa();
+
+ const int cols = src.shape()[0];
+ const int rows = src.shape()[1];
+ const int depth = src.shape()[2];
+ int upper_dims = src.shape().total_size() / (cols * rows);
+
+ float coeff = info.scale_coeff();
+ int radius_cols = norm_size / 2;
+
+ // IN_MAP_1D and CROSS_MAP normalize over a single axis only
+ int radius_rows = (NormType::IN_MAP_2D == type) ? norm_size / 2 : 0;
+
+ if(type == NormType::CROSS_MAP)
+ {
+ // Remove also depth from upper dimensions since it is the dimension we
+ // want to use for normalization
+ upper_dims /= depth;
+
+ for(int r = 0; r < upper_dims; ++r)
+ {
+ for(int i = 0; i < rows; ++i)
+ {
+ for(int k = 0; k < cols; ++k)
+ {
+ for(int l = 0; l < depth; ++l)
+ {
+ float accumulated_scale = 0.f;
+
+ for(int j = -radius_cols; j <= radius_cols; ++j)
+ {
+ const int z = l + j;
+
+ if(z >= 0 && z < depth)
+ {
+ const T value = src[k + i * cols + z * rows * cols + r * cols * rows * depth];
+ accumulated_scale += value * value;
+ }
+ }
+
+ dst[k + i * cols + l * rows * cols + r * cols * rows * depth] = kappa + accumulated_scale * coeff;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for(int r = 0; r < upper_dims; ++r)
+ {
+ for(int i = 0; i < rows; ++i)
+ {
+ for(int k = 0; k < cols; ++k)
+ {
+ float accumulated_scale = 0.f;
+
+ for(int j = -radius_rows; j <= radius_rows; ++j)
+ {
+ const int y = i + j;
+ for(int l = -radius_cols; l <= radius_cols; ++l)
+ {
+ const int x = k + l;
+
+ if((x >= 0 && y >= 0) && (x < cols && y < rows))
+ {
+ const T value = src[x + y * cols + r * cols * rows];
+ accumulated_scale += value * value;
+ }
+ }
+ }
+
+ dst[k + i * cols + r * cols * rows] = kappa + accumulated_scale * coeff;
+ }
+ }
+ }
+ }
+
+ if(beta == 1.f)
+ {
+ for(int i = 0; i < dst.num_elements(); ++i)
+ {
+ dst[i] = src[i] / dst[i];
+ }
+ }
+ else if(beta == 0.5f)
+ {
+ for(int i = 0; i < dst.num_elements(); ++i)
+ {
+ dst[i] = src[i] / std::sqrt(dst[i]);
+ }
+ }
+ else
+ {
+ for(int i = 0; i < dst.num_elements(); ++i)
+ {
+ dst[i] = src[i] * std::exp(std::log(dst[i]) * -beta);
+ }
+ }
+
+ return dst;
+}
+
+template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type>
+SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info)
+{
+ using namespace fixed_point_arithmetic;
+
+ // Create reference
+ SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
+
+ // Compute reference
+ const int fixed_point_position = src.fixed_point_position();
+
+ const uint32_t norm_size = info.norm_size();
+ NormType type = info.type();
+ fixed_point<T> beta(info.beta(), fixed_point_position);
+ fixed_point<T> kappa(info.kappa(), fixed_point_position);
+
+ const int cols = src.shape()[0];
+ const int rows = src.shape()[1];
+ const int depth = src.shape()[2];
+ int upper_dims = src.shape().total_size() / (cols * rows);
+
+ fixed_point<T> coeff(info.scale_coeff(), fixed_point_position);
+ int radius_cols = norm_size / 2;
+
+ // IN_MAP_1D and CROSS_MAP normalize over a single axis only
+ int radius_rows = (NormType::IN_MAP_2D == type) ? norm_size / 2 : 0;
+
+ if(type == NormType::CROSS_MAP)
+ {
+ // Remove also depth from upper dimensions since it is the dimension we
+ // want to use for normalization
+ upper_dims /= depth;
+
+ for(int r = 0; r < upper_dims; ++r)
+ {
+ for(int i = 0; i < rows; ++i)
+ {
+ for(int k = 0; k < cols; ++k)
+ {
+ for(int l = 0; l < depth; ++l)
+ {
+ fixed_point<T> accumulated_scale(0.f, fixed_point_position);
+
+ for(int j = -radius_cols; j <= radius_cols; ++j)
+ {
+ const int z = l + j;
+
+ if(z >= 0 && z < depth)
+ {
+ const T value = src[k + i * cols + z * rows * cols + r * cols * rows * depth];
+ const fixed_point<T> fp_value(value, fixed_point_position, true);
+ accumulated_scale = add(accumulated_scale, mul(fp_value, fp_value));
+ }
+ }
+
+ accumulated_scale = add(kappa, mul(accumulated_scale, coeff));
+ dst[k + i * cols + l * rows * cols + r * cols * rows * depth] = accumulated_scale.raw();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for(int r = 0; r < upper_dims; ++r)
+ {
+ for(int i = 0; i < rows; ++i)
+ {
+ for(int k = 0; k < cols; ++k)
+ {
+ fixed_point<T> accumulated_scale(0.f, fixed_point_position);
+
+ for(int j = -radius_rows; j <= radius_rows; ++j)
+ {
+ const int y = i + j;
+
+ for(int l = -radius_cols; l <= radius_cols; ++l)
+ {
+ const int x = k + l;
+
+ if((x >= 0 && y >= 0) && (x < cols && y < rows))
+ {
+ const T value = src[x + y * cols + r * cols * rows];
+ const fixed_point<T> fp_value(value, fixed_point_position, true);
+ accumulated_scale = add(accumulated_scale, mul(fp_value, fp_value));
+ }
+ }
+ }
+
+ accumulated_scale = add(kappa, mul(accumulated_scale, coeff));
+ dst[k + i * cols + r * cols * rows] = accumulated_scale.raw();
+ }
+ }
+ }
+ }
+
+ if(info.beta() == 1.f)
+ {
+ for(int i = 0; i < dst.num_elements(); ++i)
+ {
+ fixed_point<T> res = div(fixed_point<T>(src[i], fixed_point_position, true), fixed_point<T>(dst[i], fixed_point_position, true));
+ dst[i] = res.raw();
+ }
+ }
+ else
+ {
+ const fixed_point<T> beta(info.beta(), fixed_point_position);
+
+ for(int i = 0; i < dst.num_elements(); ++i)
+ {
+ fixed_point<T> res = pow(fixed_point<T>(dst[i], fixed_point_position, true), beta);
+ res = div(fixed_point<T>(src[i], fixed_point_position, true), res);
+ dst[i] = res.raw();
+ }
+ }
+
+ return dst;
+}
+
+template SimpleTensor<float> normalization_layer(const SimpleTensor<float> &src, NormalizationLayerInfo info);
+template SimpleTensor<half_float::half> normalization_layer(const SimpleTensor<half_float::half> &src, NormalizationLayerInfo info);
+template SimpleTensor<qint8_t> normalization_layer(const SimpleTensor<qint8_t> &src, NormalizationLayerInfo info);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation_new/CPP/NormalizationLayer.h b/tests/validation_new/CPP/NormalizationLayer.h
new file mode 100644
index 0000000000..54284b1d50
--- /dev/null
+++ b/tests/validation_new/CPP/NormalizationLayer.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_TEST_NORMALIZATION_LAYER_H__
+#define __ARM_COMPUTE_TEST_NORMALIZATION_LAYER_H__
+
+#include "tests/validation_new/Helpers.h"
+#include "tests/validation_new/SimpleTensor.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type = 0>
+SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info);
+
+template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
+SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_TEST_NORMALIZATION_LAYER_H__ */
diff --git a/tests/validation_new/NEON/NormalizationLayer.cpp b/tests/validation_new/NEON/NormalizationLayer.cpp
new file mode 100644
index 0000000000..f364975332
--- /dev/null
+++ b/tests/validation_new/NEON/NormalizationLayer.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "framework/Asserts.h"
+#include "framework/Macros.h"
+#include "framework/datasets/Datasets.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets_new/NormalizationTypesDataset.h"
+#include "tests/datasets_new/ShapeDatasets.h"
+#include "tests/validation_new/Validation.h"
+#include "tests/validation_new/fixtures/NormalizationLayerFixture.h"
+#include "tests/validation_new/half.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+/** Tolerance for float operations */
+#ifdef ARM_COMPUTE_ENABLE_FP16
+constexpr float tolerance_f16 = 0.001f;
+#endif /* ARM_COMPUTE_ENABLE_FP16 */
+constexpr float tolerance_f32 = 0.00001f;
+/** Tolerance for fixed point operations */
+constexpr int8_t tolerance_qs8 = 2;
+
+/** Input data set. */
+const auto NormalizationDataset = combine(combine(combine(datasets::SmallShapes(), datasets::NormalizationTypes()), framework::dataset::make("NormalizationSize", 3, 9, 2)),
+ framework::dataset::make("Beta", { 0.5f, 1.f, 2.f }));
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(NormalizationLayer)
+
+//TODO(COMPMID-415): Missing configuration?
+
+template <typename T>
+using NENormalizationLayerFixture = NormalizationValidationFixture<Tensor, Accessor, NENormalizationLayer, T>;
+
+TEST_SUITE(Float)
+#ifdef ARM_COMPUTE_ENABLE_FP16
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, NENormalizationLayerFixture<half_float::half>, framework::DatasetMode::PRECOMMIT, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_f16);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NENormalizationLayerFixture<half_float::half>, framework::DatasetMode::NIGHTLY, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_f16);
+}
+TEST_SUITE_END()
+#endif /* ARM_COMPUTE_ENABLE_FP16 */
+
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, NENormalizationLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_f32);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NENormalizationLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
+template <typename T>
+using NENormalizationLayerFixedPointFixture = NormalizationValidationFixedPointFixture<Tensor, Accessor, NENormalizationLayer, T>;
+
+TEST_SUITE(Quantized)
+TEST_SUITE(QS8)
+// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
+FIXTURE_DATA_TEST_CASE(RunSmall, NENormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDataset, framework::dataset::make("DataType",
+ DataType::QS8)),
+ framework::dataset::make("FractionalBits", 1, 6)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_qs8);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NENormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType",
+ DataType::QS8)),
+ framework::dataset::make("FractionalBits", 1, 6)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_qs8);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation_new/fixtures/NormalizationLayerFixture.h b/tests/validation_new/fixtures/NormalizationLayerFixture.h
new file mode 100644
index 0000000000..044405473b
--- /dev/null
+++ b/tests/validation_new/fixtures/NormalizationLayerFixture.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_NORMALIZATION_LAYER_FIXTURE
+#define ARM_COMPUTE_TEST_NORMALIZATION_LAYER_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "framework/Asserts.h"
+#include "framework/Fixture.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/validation_new/CPP/NormalizationLayer.h"
+
+#include <random>
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class NormalizationValidationFixedPointFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape shape, NormType norm_type, int norm_size, float beta, DataType data_type, int fractional_bits)
+ {
+ _fractional_bits = fractional_bits;
+ NormalizationLayerInfo info(norm_type, norm_size, 5, beta);
+
+ _target = compute_target(shape, info, data_type, fractional_bits);
+ _reference = compute_reference(shape, info, data_type, fractional_bits);
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor)
+ {
+ if(_fractional_bits == 0)
+ {
+ library->fill_tensor_uniform(tensor, 0);
+ }
+ else
+ {
+ const int one_fixed = 1 << _fractional_bits;
+ std::uniform_int_distribution<> distribution(-one_fixed, one_fixed);
+ library->fill(tensor, distribution, 0);
+ }
+ }
+
+ TensorType compute_target(const TensorShape &shape, NormalizationLayerInfo info, DataType data_type, int fixed_point_position = 0)
+ {
+ // Create tensors
+ TensorType src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
+ TensorType dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
+
+ // Create and configure function
+ FunctionType norm_layer;
+ norm_layer.configure(&src, &dst, info);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Fill tensors
+ fill(AccessorType(src));
+
+ // Compute function
+ norm_layer.run();
+
+ return dst;
+ }
+
+ SimpleTensor<T> compute_reference(const TensorShape &shape, NormalizationLayerInfo info, DataType data_type, int fixed_point_position = 0)
+ {
+ // Create reference
+ SimpleTensor<T> src{ shape, data_type, 1, fixed_point_position };
+
+ // Fill reference
+ fill(src);
+
+ return reference::normalization_layer<T>(src, info);
+ }
+
+ TensorType _target{};
+ SimpleTensor<T> _reference{};
+ int _fractional_bits{};
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class NormalizationValidationFixture : public NormalizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+ template <typename...>
+ void setup(TensorShape shape, NormType norm_type, int norm_size, float beta, DataType data_type)
+ {
+ NormalizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, norm_type, norm_size, beta, data_type, 0);
+ }
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_NORMALIZATION_LAYER_FIXTURE */