From b49a7153c901b5c523a3d07815b79a4f460533b1 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Tue, 11 Jul 2017 16:31:35 +0100 Subject: COMPMID-421: Added FP16 support to Softmax. Change-Id: If48178689e7cdadf1858556438c7292128be5b92 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80436 Tested-by: Kaizen Reviewed-by: Moritz Pflanzer --- tests/validation/NEON/SoftmaxLayer.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'tests/validation/NEON/SoftmaxLayer.cpp') diff --git a/tests/validation/NEON/SoftmaxLayer.cpp b/tests/validation/NEON/SoftmaxLayer.cpp index 92ca673f17..8422ba363c 100644 --- a/tests/validation/NEON/SoftmaxLayer.cpp +++ b/tests/validation/NEON/SoftmaxLayer.cpp @@ -49,7 +49,10 @@ using namespace arm_compute::test::validation; namespace { /** Tolerance for float operations */ -const float tolerance = 0.000001f; +const float tolerance_f32 = 0.000001f; +#ifdef ARM_COMPUTE_ENABLE_FP16 +const float tolerance_f16 = 0.0001f; +#endif /* ARM_COMPUTE_ENABLE_FP16*/ /** Tolerance for fixed point operations */ const float tolerance_fixed_point = 2.f; @@ -102,6 +105,23 @@ Tensor compute_softmax_layer(const TensorShape &shape, DataType dt, int fixed_po BOOST_AUTO_TEST_SUITE(NEON) BOOST_AUTO_TEST_SUITE(SoftmaxLayer) +#ifdef ARM_COMPUTE_ENABLE_FP16 +BOOST_AUTO_TEST_SUITE(Float16) +BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) +BOOST_DATA_TEST_CASE(RunSmall, SmallShapes(), shape) +{ + // Compute function + Tensor dst = compute_softmax_layer(shape, DataType::F16); + + // Compute reference + RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, DataType::F16); + + // Validate output + validate(Accessor(dst), ref_dst, tolerance_f16); +} +BOOST_AUTO_TEST_SUITE_END() +#endif /* ARM_COMPUTE_ENABLE_FP16*/ + BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * CNNDataTypes(), shape, dt) { @@ -142,7 +162,7 @@ BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * CNNFloatDataTypes(), shape, dt) RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, dt); // Validate output - validate(Accessor(dst), ref_dst, tolerance); + validate(Accessor(dst), ref_dst, tolerance_f32); } BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) @@ -155,7 +175,7 @@ BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * CNNFloatDataTypes(), shape, dt) RawTensor ref_dst = Reference::compute_reference_softmax_layer(shape, dt); // Validate output - validate(Accessor(dst), ref_dst, tolerance); + validate(Accessor(dst), ref_dst, tolerance_f32); } BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1