aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/NEON/ReduceMean.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/NEON/ReduceMean.cpp')
-rw-r--r--tests/validation/NEON/ReduceMean.cpp75
1 files changed, 46 insertions, 29 deletions
diff --git a/tests/validation/NEON/ReduceMean.cpp b/tests/validation/NEON/ReduceMean.cpp
index 821171a603..8ca0bb53a7 100644
--- a/tests/validation/NEON/ReduceMean.cpp
+++ b/tests/validation/NEON/ReduceMean.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 ARM Limited.
+ * Copyright (c) 2018-2021, 2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,10 +46,15 @@ constexpr AbsoluteTolerance<float> tolerance_f32(0.001f); /**< Tolerance value f
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
constexpr AbsoluteTolerance<float> tolerance_f16(0.03f); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit floating-point type */
#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
+#ifdef __aarch64__
constexpr AbsoluteTolerance<uint8_t> tolerance_u8(1); /**< Tolerance value for comparing reference's output against implementation's output for unsigned 8-bit asymmetric quantized type */
constexpr AbsoluteTolerance<int8_t> tolerance_s8(1); /**< Tolerance value for comparing reference's output against implementation's output for signed 8-bit asymmetric quantized type */
+#else // __aarch64__
+constexpr AbsoluteTolerance<uint8_t> tolerance_u8(2); /**< Tolerance value for comparing reference's output against implementation's output for unsigned 8-bit asymmetric quantized type */
+constexpr AbsoluteTolerance<int8_t> tolerance_s8(2); /**< Tolerance value for comparing reference's output against implementation's output for signed 8-bit asymmetric quantized type */
+#endif // __aarch64__
-const auto axis_keep = combine(framework::dataset::make("Axis", { Coordinates(0), Coordinates(1, 0), Coordinates(1, 2), Coordinates(0, 2), Coordinates(1, 3), Coordinates(0, 1, 2, 3) }),
+const auto axis_keep = combine(framework::dataset::make("Axis", { Coordinates(0), Coordinates(1, 0), Coordinates(1, 2), Coordinates(0, 2), Coordinates(1, 3), Coordinates(2, 3), Coordinates(0, 1, 2, 3) }),
framework::dataset::make("KeepDims", { true }));
const auto axis_drop = combine(framework::dataset::make("Axis", { Coordinates(0), Coordinates(1), Coordinates(3) }), framework::dataset::make("KeepDims", { false }));
} // namespace
@@ -83,28 +88,6 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
// clang-format on
// *INDENT-ON*
-DATA_TEST_CASE(Configuration,
- framework::DatasetMode::ALL,
- combine(datasets::SmallShapes(), framework::dataset::make("DataType", { DataType::F32 })),
- shape, data_type)
-{
- // Create tensors
- Tensor ref_src = create_tensor<Tensor>(shape, data_type);
- Tensor dst;
-
- Coordinates axis(1);
-
- // Create and Configure function
- NEReduceMean reduce_mean;
- reduce_mean.configure(&ref_src, axis, true, &dst);
-
- // Validate valid region
- TensorShape output_shape = shape;
- output_shape.set(1, 1);
- const ValidRegion valid_region = shape_to_valid_region(output_shape);
- validate(dst.info()->valid_region(), valid_region);
-}
-
template <typename T>
using NEReduceMeanFixture = ReduceMeanFixture<Tensor, Accessor, NEReduceMean, T>;
@@ -160,16 +143,33 @@ TEST_SUITE(QASYMM8)
FIXTURE_DATA_TEST_CASE(RunSmall,
NEReduceMeanQuantizedFixture<uint8_t>,
framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(datasets::Small4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), concat(axis_keep, axis_drop)), framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 255, 5) })))
+ combine(combine(combine(combine(datasets::Small4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), concat(axis_keep, axis_drop)),
+ framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.f / 255, 5) })),
+ framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.f / 255, 5) })))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_u8);
+}
+
+TEST_SUITE(Requant)
+FIXTURE_DATA_TEST_CASE(RunSmall,
+ NEReduceMeanQuantizedFixture<uint8_t>,
+ framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(combine(datasets::Small4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), axis_drop),
+ framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.f / 255, 5) })),
+ framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.f / 200, 16) })))
{
// Validate output
validate(Accessor(_target), _reference, tolerance_u8);
}
+TEST_SUITE_END() // Requant
FIXTURE_DATA_TEST_CASE(RunLarge,
NEReduceMeanQuantizedFixture<uint8_t>,
framework::DatasetMode::NIGHTLY,
- combine(combine(combine(datasets::Large4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), concat(axis_keep, axis_drop)), framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 255, 5) })))
+ combine(combine(combine(combine(datasets::Large4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), concat(axis_keep, axis_drop)),
+ framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.f / 255, 5) })),
+ framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.f / 255, 5) })))
{
// Validate output
validate(Accessor(_target), _reference, tolerance_u8);
@@ -180,15 +180,32 @@ TEST_SUITE(QASYMM8_SIGNED)
FIXTURE_DATA_TEST_CASE(RunSmall,
NEReduceMeanQuantizedFixture<int8_t>,
framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(datasets::Small4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), concat(axis_keep, axis_drop)), framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 127, -10), QuantizationInfo(1.f / 250, -20) })))
+ combine(combine(combine(combine(datasets::Small4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), concat(axis_keep, axis_drop)),
+ framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.f / 127, -10), QuantizationInfo(1.f / 250, -20) })),
+ framework::dataset::make("QuantizationInfoInputOutput", { QuantizationInfo(1.f / 127, -10) })))
{
// Validate output
validate(Accessor(_target), _reference, tolerance_s8);
}
+TEST_SUITE(Requant)
+FIXTURE_DATA_TEST_CASE(RunSmall,
+ NEReduceMeanQuantizedFixture<int8_t>,
+ framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(combine(datasets::Small4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), axis_drop),
+ framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.f / 102, 2) })),
+ framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.f / 113, 10) })))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_s8);
+}
+TEST_SUITE_END() // Requant
+
FIXTURE_DATA_TEST_CASE(RunLarge,
NEReduceMeanQuantizedFixture<int8_t>,
framework::DatasetMode::NIGHTLY,
- combine(combine(combine(datasets::Large4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), concat(axis_keep, axis_drop)), framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 127, 0) })))
+ combine(combine(combine(combine(datasets::Large4DShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), concat(axis_keep, axis_drop)),
+ framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.f / 127, -10) })),
+ framework::dataset::make("QuantizationInfoInputOutput", { QuantizationInfo(1.f / 127, -10) })))
{
// Validate output
validate(Accessor(_target), _reference, tolerance_s8);
@@ -196,7 +213,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge,
TEST_SUITE_END() // QASYMM8_SIGNED
TEST_SUITE_END() // Quantized
TEST_SUITE_END() // ReduceMean
-TEST_SUITE_END() // NEON
+TEST_SUITE_END() // Neon
} // namespace validation
} // namespace test
} // namespace arm_compute