From 7d323a6adca97c130a0fc7c6299c75d581906edd Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Wed, 5 Jul 2017 20:05:23 +0100 Subject: COMPMID-440, COMPMID-441 - Port CLConvolutionLayer and CLFullyConnectedLayer to support 16 bit fixed point Change-Id: I8d8ef2cb5ec453eb83fba8d8077550b96ed4bceb Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79837 Reviewed-by: Moritz Pflanzer Reviewed-by: Georgios Pinitas Tested-by: Kaizen --- tests/validation/CL/ConvolutionLayer.cpp | 12 ++++++------ tests/validation/CL/FullyConnectedLayer.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'tests/validation/CL') diff --git a/tests/validation/CL/ConvolutionLayer.cpp b/tests/validation/CL/ConvolutionLayer.cpp index f613f77e5e..7c5a1eb254 100644 --- a/tests/validation/CL/ConvolutionLayer.cpp +++ b/tests/validation/CL/ConvolutionLayer.cpp @@ -47,7 +47,7 @@ using namespace arm_compute::test::validation; namespace { const float tolerance_f32 = 1e-03f; /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ -const float tolerance_qs8 = 1.0f; /**< Tolerance value for comparing reference's output against implementation's output for DataType::QS8 */ +const float tolerance_q = 1.0f; /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */ CLTensor compute_convolution_layer(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, DataType dt, const PadStrideInfo &conv_info, int fixed_point_position) @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_SUITE(GEMM) BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) BOOST_DATA_TEST_CASE(Configuration, - AlexNetConvolutionLayerDataset() * boost::unit_test::data::make({ DataType::F32, DataType::QS8 }), + AlexNetConvolutionLayerDataset() * boost::unit_test::data::make({ DataType::F32, DataType::QS8, DataType::QS16 }), conv_set, dt) { // Set fixed point position data type allowed @@ -189,7 +189,7 @@ BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(Quantized) BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) BOOST_DATA_TEST_CASE(SmallConvolutionLayer, - SmallConvolutionLayerDataset() * boost::unit_test::data::make(DataType::QS8) * boost::unit_test::data::xrange(4, 7), + SmallConvolutionLayerDataset() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 }) * boost::unit_test::data::xrange(4, 7), conv_set, dt, fixed_point_position) { // Compute function @@ -199,12 +199,12 @@ BOOST_DATA_TEST_CASE(SmallConvolutionLayer, RawTensor ref_dst = Reference::compute_reference_convolution_layer(conv_set.src_shape, conv_set.weights_shape, conv_set.bias_shape, conv_set.dst_shape, dt, conv_set.info, fixed_point_position); // Validate output - validate(CLAccessor(dst), ref_dst, tolerance_qs8); + validate(CLAccessor(dst), ref_dst, tolerance_q); } BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) BOOST_DATA_TEST_CASE(LargeConvolutionLayer, - AlexNetConvolutionLayerDataset() * boost::unit_test::data::make(DataType::QS8) * boost::unit_test::data::xrange(4, 7), + AlexNetConvolutionLayerDataset() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 }) * boost::unit_test::data::xrange(4, 7), conv_set, dt, fixed_point_position) { // Compute function @@ -214,7 +214,7 @@ BOOST_DATA_TEST_CASE(LargeConvolutionLayer, RawTensor ref_dst = Reference::compute_reference_convolution_layer(conv_set.src_shape, conv_set.weights_shape, conv_set.bias_shape, conv_set.dst_shape, dt, conv_set.info, fixed_point_position); // Validate output - validate(CLAccessor(dst), ref_dst, tolerance_qs8); + validate(CLAccessor(dst), ref_dst, tolerance_q); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/validation/CL/FullyConnectedLayer.cpp b/tests/validation/CL/FullyConnectedLayer.cpp index 4d00c30d16..974a0bd1d5 100644 --- a/tests/validation/CL/FullyConnectedLayer.cpp +++ b/tests/validation/CL/FullyConnectedLayer.cpp @@ -44,7 +44,7 @@ using namespace arm_compute::test::validation; namespace { const float tolerance_f32 = 1e-03f; /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ -const float tolerance_qs8 = 1.0f; /**< Tolerance value for comparing reference's output against implementation's output for DataType::QS8 */ +const float tolerance_q = 1.0f; /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */ CLTensor compute_fully_connected_layer(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, DataType dt, bool transpose_weights, int fixed_point_position) @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_SUITE(FullyConnectedLayer) BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) BOOST_DATA_TEST_CASE(Configuration, - SmallFullyConnectedLayerDataset() * boost::unit_test::data::make({ DataType::F32, DataType::QS8 }), + SmallFullyConnectedLayerDataset() * boost::unit_test::data::make({ DataType::F32, DataType::QS8, DataType::QS16 }), fc_set, dt) { // Set fixed point position data type allowed @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(Quantized) BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) BOOST_DATA_TEST_CASE(RunSmall, - SmallFullyConnectedLayerDataset() * boost::unit_test::data::make({ DataType::QS8 }) * boost::unit_test::data::xrange(4, 7), + SmallFullyConnectedLayerDataset() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 }) * boost::unit_test::data::xrange(4, 7), fc_set, dt, fixed_point_position) { // Compute function @@ -198,12 +198,12 @@ BOOST_DATA_TEST_CASE(RunSmall, RawTensor ref_dst = Reference::compute_reference_fully_connected_layer(fc_set.src_shape, fc_set.weights_shape, fc_set.bias_shape, fc_set.dst_shape, dt, fc_set.transpose_weights, fixed_point_position); // Validate output - validate(CLAccessor(dst), ref_dst, tolerance_qs8); + validate(CLAccessor(dst), ref_dst, tolerance_q); } BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) BOOST_DATA_TEST_CASE(RunLarge, - LargeFullyConnectedLayerDataset() * boost::unit_test::data::make({ DataType::QS8 }) * boost::unit_test::data::xrange(4, 7), + LargeFullyConnectedLayerDataset() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 }) * boost::unit_test::data::xrange(4, 7), fc_set, dt, fixed_point_position) { // Compute function @@ -213,7 +213,7 @@ BOOST_DATA_TEST_CASE(RunLarge, RawTensor ref_dst = Reference::compute_reference_fully_connected_layer(fc_set.src_shape, fc_set.weights_shape, fc_set.bias_shape, fc_set.dst_shape, dt, fc_set.transpose_weights, fixed_point_position); // Validate output - validate(CLAccessor(dst), ref_dst, tolerance_qs8); + validate(CLAccessor(dst), ref_dst, tolerance_q); } BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1