diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2017-07-10 16:05:21 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:15:39 +0100 |
commit | 097967568f9363d06df3ac21403edcab57de39d7 (patch) | |
tree | 1e731ebc741076efd230d88d08eac99fa4284b6f /tests/validation | |
parent | dcdc85ef876e854749db58ecd60c37f64a627536 (diff) | |
download | ComputeLibrary-097967568f9363d06df3ac21403edcab57de39d7.tar.gz |
COMPMID-429: Port CLSoftmaxLayer to QS16.
Change-Id: I3a0394364629654747439372d32f692b6ca29ee0
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80219
Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Diffstat (limited to 'tests/validation')
-rw-r--r-- | tests/validation/CL/SoftmaxLayer.cpp | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/tests/validation/CL/SoftmaxLayer.cpp b/tests/validation/CL/SoftmaxLayer.cpp index 43efc04d36..2680070e50 100644 --- a/tests/validation/CL/SoftmaxLayer.cpp +++ b/tests/validation/CL/SoftmaxLayer.cpp @@ -49,10 +49,9 @@ using namespace arm_compute::test::validation; namespace { -/** Tolerance for float operations */ -const float tolerance = 0.000001f; -/** Tolerance for fixed point operations */ -const float tolerance_fixed_point = 2.f; +const float tolerance = 0.000001f; /** Tolerance for float operations */ +const float tolerance_qs8 = 2.f; /** Tolerance for QS8 fixed point operations */ +const float tolerance_qs16 = 2.f; /** Tolerance for QS16 fixed point operations */ /** Compute OpenCL softmax layer function. * @@ -160,35 +159,69 @@ BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * CNNFloatDataTypes(), shape, dt) BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(Quantized) +BOOST_AUTO_TEST_SUITE(QS8) +// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5 BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) -BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * CNNFixedPointDataTypes() * boost::unit_test::data::xrange(1, 6), - shape, dt, fixed_point_position) +BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::xrange(1, 6), + shape, fixed_point_position) { // Compute function - CLTensor dst = compute_softmax_layer(shape, dt, fixed_point_position); + CLTensor dst = compute_softmax_layer(shape, DataType::QS8, fixed_point_position); // Compute reference - RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, dt, fixed_point_position); + RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, DataType::QS8, fixed_point_position); // Validate output - validate(CLAccessor(dst), ref_dst, tolerance_fixed_point); + validate(CLAccessor(dst), ref_dst, tolerance_qs8); } BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * CNNFixedPointDataTypes() * boost::unit_test::data::xrange(1, 6), - shape, dt, fixed_point_position) +BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::xrange(1, 6), + shape, fixed_point_position) { // Compute function - CLTensor dst = compute_softmax_layer(shape, dt, fixed_point_position); + CLTensor dst = compute_softmax_layer(shape, DataType::QS8, fixed_point_position); // Compute reference - RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, dt, fixed_point_position); + RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, DataType::QS8, fixed_point_position); // Validate output - validate(CLAccessor(dst), ref_dst, tolerance_fixed_point); + validate(CLAccessor(dst), ref_dst, tolerance_qs8); } BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE(QS16) +// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14 +BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) +BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::xrange(1, 14), + shape, fixed_point_position) +{ + // Compute function + CLTensor dst = compute_softmax_layer(shape, DataType::QS16, fixed_point_position); + + // Compute reference + RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, DataType::QS16, fixed_point_position); + + // Validate output + validate(CLAccessor(dst), ref_dst, tolerance_qs16); +} + +BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) +BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::xrange(1, 14), + shape, fixed_point_position) +{ + // Compute function + CLTensor dst = compute_softmax_layer(shape, DataType::QS16, fixed_point_position); + + // Compute reference + RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, DataType::QS16, fixed_point_position); + + // Validate output + validate(CLAccessor(dst), ref_dst, tolerance_qs16); +} +BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() + BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END() #endif /* DOXYGEN_SKIP_THIS */ |