From 801bbcb2f9a16633d0071b55aaf93b89870248ee Mon Sep 17 00:00:00 2001 From: Sheri Zhang Date: Mon, 3 Aug 2020 20:11:56 +0100 Subject: COMPMID-2479: Extend CLPoolingLayer max pooling to extract indices Fix PoolingLayer max pooling reference bug to extract indices. Extend CLPoolingLayer max pooling to extract indices, all the paddings need to be substracted. Signed-off-by: Sheri Zhang Change-Id: If8e82e7f7e03172ad05f5a7cd5f13cf682fd1ffc Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3649 Tested-by: Arm Jenkins Reviewed-by: Pablo Marquez Comments-Addressed: Arm Jenkins --- tests/validation/CL/PoolingLayer.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/validation/CL/PoolingLayer.cpp') diff --git a/tests/validation/CL/PoolingLayer.cpp b/tests/validation/CL/PoolingLayer.cpp index b4ba38e9aa..eefad4ab2c 100644 --- a/tests/validation/CL/PoolingLayer.cpp +++ b/tests/validation/CL/PoolingLayer.cpp @@ -71,6 +71,12 @@ framework::dataset::make("PoolingSize", { Size2D(2, 2), Size2D(5, 7) })), framework::dataset::make("PadStride", { PadStrideInfo(1, 2, 1, 1) })), framework::dataset::make("ExcludePadding", { true })); +const auto PoolingLayerDatasetFPIndicesSmall = combine(combine(combine(framework::dataset::make("PoolingType", +{ PoolingType::MAX }), +framework::dataset::make("PoolingSize", { Size2D(2, 2) })), +framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 2, 0, 0) })), +framework::dataset::make("ExcludePadding", { true, false })); + constexpr AbsoluteTolerance tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for 32-bit floating-point type */ constexpr AbsoluteTolerance tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit floating-point type */ constexpr AbsoluteTolerance tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit asymmetric type */ @@ -134,6 +140,9 @@ using CLSpecialPoolingLayerFixture = SpecialPoolingLayerValidationFixture using CLMixedPrecesionPoolingLayerFixture = PoolingLayerValidationMixedPrecisionFixture; +template +using CLPoolingLayerIndicesFixture = PoolingLayerIndicesValidationFixture; + TEST_SUITE(Float) TEST_SUITE(FP32) FIXTURE_DATA_TEST_CASE(RunSpecial, CLSpecialPoolingLayerFixture, framework::DatasetMode::ALL, datasets::PoolingLayerDatasetSpecial() * framework::dataset::make("DataType", DataType::F32)) @@ -157,6 +166,17 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLPoolingLayerFixture, framework::Datase // Validate output validate(CLAccessor(_target), _reference, tolerance_f32); } + +FIXTURE_DATA_TEST_CASE(RunSmallIndices, CLPoolingLayerIndicesFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetFPIndicesSmall, + framework::dataset::make("DataType", + DataType::F32))), + pool_data_layout_dataset)) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_f32); + validate(CLAccessor(_target_indices), _ref_indices); +} + TEST_SUITE_END() // FP32 TEST_SUITE(FP16) @@ -176,6 +196,15 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLMixedPrecesionPoolingLayerFixture, fram // Validate output validate(CLAccessor(_target), _reference, tolerance_f16); } +FIXTURE_DATA_TEST_CASE(RunSmallIndices, CLPoolingLayerIndicesFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetFPIndicesSmall, + framework::dataset::make("DataType", + DataType::F16))), + pool_data_layout_dataset)) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_f32); + validate(CLAccessor(_target_indices), _ref_indices); +} TEST_SUITE_END() // FP16 TEST_SUITE_END() // Float -- cgit v1.2.1