From 5e549fa8ff058eb06cb74de43b9f89a08d0b4a9c Mon Sep 17 00:00:00 2001 From: Mohammed Suhail Munshi Date: Wed, 16 Mar 2022 11:14:06 +0000 Subject: Add CLPool3d Int8 Support - Adds Qasymm8 and Qasymm8_signed support to the 3d pool operator Resolves: COMPMID-4669 Signed-off-by: Mohammed Suhail Munshi Change-Id: I36038c2b7c4f36baf67f7aae801356890e104538 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/410496 Tested-by: bsgcomp Reviewed-by: Sheri Zhang Comments-Addressed: bsgcomp Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7391 Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir Comments-Addressed: Arm Jenkins --- tests/validation/CL/Pooling3dLayer.cpp | 74 +++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 6 deletions(-) (limited to 'tests/validation/CL/Pooling3dLayer.cpp') diff --git a/tests/validation/CL/Pooling3dLayer.cpp b/tests/validation/CL/Pooling3dLayer.cpp index 5c80351da2..84d630e6cf 100644 --- a/tests/validation/CL/Pooling3dLayer.cpp +++ b/tests/validation/CL/Pooling3dLayer.cpp @@ -59,10 +59,18 @@ const auto Pooling3dLayerDatasetFPSmall = combine(combine(combine(combine(datase framework::dataset::make("Padding", { Padding3D(0, 0, 0), Padding3D(1, 1, 1), Padding3D(1, 0, 0) })), framework::dataset::make("ExcludePadding", { true, false })); +const auto Pooling3DLayerDatasetQuantized = combine(combine(combine(combine(framework::dataset::make("PoolingType", { PoolingType::MAX, PoolingType::AVG }), + framework::dataset::make("PoolingSize", { Size3D(2, 3, 2) })), + framework::dataset::make("Stride", { Size3D(1, 1, 1), Size3D(2, 1, 1), Size3D(1, 2, 1), Size3D(1, 1, 2), Size3D(2, 2, 1)})), + framework::dataset::make("Padding", { Padding3D(0, 0, 0), Padding3D(1, 1, 1), Padding3D(1, 0, 0) })), + framework::dataset::make("ExcludePadding", { true })); + using ShapeDataset = framework::dataset::ContainerDataset>; -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.1f); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit floating-point type */ +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.1f); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit floating-point type */ +constexpr AbsoluteTolerance tolerance_qasymm8_signed(1); /**< Tolerance value for comparing reference's output against implementation's output for QASYMM8_SIGNED integer datatype*/ +constexpr AbsoluteTolerance tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit asymmetric type */ } // namespace @@ -133,8 +141,64 @@ using CLSpecialPooling3dLayerFixture = SpecialPooling3dLayerValidationFixture using CLPooling3dLayerGlobalFixture = Pooling3dLayerGlobalValidationFixture; +template +using CLPooling3dLayerQuantizedFixture = Pooling3dLayerValidationQuantizedFixture; + // clang-format on // *INDENT-ON* +TEST_SUITE(QUANTIZED) + +TEST_SUITE(QASYMM8) +// Small Dataset Quantized Dataset +FIXTURE_DATA_TEST_CASE(RunSmall, CLPooling3dLayerQuantizedFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small5dShapes(), + combine(Pooling3DLayerDatasetQuantized, + framework::dataset::make("DataType", DataType::QASYMM8))), + framework::dataset::make("InputQuantInfo", { QuantizationInfo(1.f / 127.f, 10), QuantizationInfo(1.f / 127.f, 10) })), + framework::dataset::make("OutputQuantInfo", { QuantizationInfo(1.f / 127.f, 5), QuantizationInfo(1.f / 127.f, 10) }))) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_qasymm8); +} + +// Large Dataset Quantized Dataset +FIXTURE_DATA_TEST_CASE(RunLarge, CLPooling3dLayerQuantizedFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large5dShapes(), + combine(Pooling3DLayerDatasetQuantized, + framework::dataset::make("DataType", DataType::QASYMM8))), + framework::dataset::make("InputQuantInfo", { QuantizationInfo(1.f / 127.f, 10), QuantizationInfo(1.f / 127.f, 10) })), + framework::dataset::make("OutputQuantInfo", { QuantizationInfo(1.f / 127.f, 5), QuantizationInfo(1.f / 127.f, 10) }))) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_qasymm8); +} +TEST_SUITE_END() + +TEST_SUITE(QASYMM8_SIGNED) + +// Large Dataset Quantized Dataset Signed +FIXTURE_DATA_TEST_CASE(RunSmall, CLPooling3dLayerQuantizedFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small5dShapes(), + combine(Pooling3DLayerDatasetQuantized, + framework::dataset::make("DataType", DataType::QASYMM8_SIGNED))), + framework::dataset::make("InputQuantInfo", { QuantizationInfo(1.f / 127.f, -10), QuantizationInfo(1.f / 127.f, -10) })), + framework::dataset::make("OutputQuantInfo", { QuantizationInfo(1.f / 127.f, -5), QuantizationInfo(1.f / 127.f, -10) }))) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_qasymm8_signed); +} + +// Large Dataset Quantized pooling test +FIXTURE_DATA_TEST_CASE(RunLarge, CLPooling3dLayerQuantizedFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large5dShapes(), + combine(Pooling3DLayerDatasetQuantized, + framework::dataset::make("DataType", DataType::QASYMM8_SIGNED))), + framework::dataset::make("InputQuantInfo", { QuantizationInfo(1.f / 127.f, -10), QuantizationInfo(1.f / 127.f, -10) })), + framework::dataset::make("OutputQuantInfo", { QuantizationInfo(1.f / 127.f, -5), QuantizationInfo(1.f / 127.f, -10) }))) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_qasymm8_signed); +} + +TEST_SUITE_END() +TEST_SUITE_END() + TEST_SUITE(Float) TEST_SUITE(FP32) @@ -152,8 +216,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLPooling3dLayerFixture, framework::Data } FIXTURE_DATA_TEST_CASE(RunLarge, CLPooling3dLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large5dShapes(), combine(Pooling3dLayerDatasetFP, - framework::dataset::make("DataType", - DataType::F32)))) + framework::dataset::make("DataType", DataType::F32)))) { // Validate output validate(CLAccessor(_target), _reference, tolerance_f32); @@ -219,8 +282,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLPooling3dLayerFixture, framework::Datas } FIXTURE_DATA_TEST_CASE(RunLarge, CLPooling3dLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large5dShapes(), combine(Pooling3dLayerDatasetFP, - framework::dataset::make("DataType", - DataType::F16)))) + framework::dataset::make("DataType", DataType::F16)))) { // Validate output validate(CLAccessor(_target), _reference, tolerance_f16); -- cgit v1.2.1