diff options
author | Sang-Hoon Park <sang-hoon.park@arm.com> | 2019-11-13 17:08:12 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-12-20 11:47:29 +0000 |
commit | 0779fecbf897fe85c5e13da52b129e439c4cc75d (patch) | |
tree | c9d9edd74eb423099d9c8d31e1d655a2b6e59173 /tests/validation/CL | |
parent | 64e738f32187e8a4ea2624d15b48ed79b34cc824 (diff) | |
download | ComputeLibrary-0779fecbf897fe85c5e13da52b129e439c4cc75d.tar.gz |
COMPMID-2763 [CL] add support for QASYMM8_SIGNED to SoftmaxLayer
Change-Id: I4556bde3aa51eb874a4e674dbbd575fa4491c088
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-on: https://review.mlplatform.org/c/2375
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/validation/CL')
-rw-r--r-- | tests/validation/CL/SoftmaxLayer.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/tests/validation/CL/SoftmaxLayer.cpp b/tests/validation/CL/SoftmaxLayer.cpp index ae7adec9f2..5ee929f6b9 100644 --- a/tests/validation/CL/SoftmaxLayer.cpp +++ b/tests/validation/CL/SoftmaxLayer.cpp @@ -49,6 +49,15 @@ RelativeTolerance<float> tolerance_f32(0.001f); /** Tolerance for quantized operations */ constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); +constexpr AbsoluteTolerance<int8_t> tolerance_qasymm8_signed(1); + +/* + The following tolerance number is used as a workaround for the mismatches + caused by float computation in reference (and NEON) kernel + and integer computations in OpenCL kernel. + COMPMID-2958 is created to investigate this. +*/ +constexpr float tolerance_number_qasymm8_signed = 0.05f; /** CNN data types */ const auto CNNDataTypes = framework::dataset::make("DataType", @@ -110,6 +119,8 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip( TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 12)), + TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, + QuantizationInfo(1.f/256, 12)) }), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16), TensorInfo(TensorShape(27U, 11U), 1, DataType::F32), @@ -120,8 +131,10 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip( TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 0)), + TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, + QuantizationInfo(1.f/256, -128)), })), - framework::dataset::make("Expected", { false, false, false, false, false, true, true })), + framework::dataset::make("Expected", { false, false, false, false, false, true, true, true })), input_info, output_info, expected) { ARM_COMPUTE_EXPECT(bool(CLSoftmaxLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS); @@ -221,11 +234,24 @@ FIXTURE_DATA_TEST_CASE(Run4D, CLSoftmaxLayerQuantizedFixture<uint8_t>, framework validate(CLAccessor(_target), _reference, tolerance_qasymm8); } -TEST_SUITE_END() -TEST_SUITE_END() +TEST_SUITE_END() // QASYMM8 -TEST_SUITE_END() -TEST_SUITE_END() +TEST_SUITE(QASYMM8_SIGNED) + +FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), + framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), + combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), + framework::dataset::make("Beta", { 1.0f, 2.f }))), + framework::dataset::make("Axis", { 1, 2 }))) +{ + // Validate output + validate(CLAccessor(_target), _reference, tolerance_qasymm8_signed, tolerance_number_qasymm8_signed); +} + +TEST_SUITE_END() // QASYMM8_SIGNED +TEST_SUITE_END() // Quantized +TEST_SUITE_END() // SoftmaxLayer +TEST_SUITE_END() // CL } // namespace validation } // namespace test } // namespace arm_compute |