Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 1 | /* |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2021 Arm Limited. |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "arm_compute/core/Types.h" |
| 25 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 28 | #include "tests/CL/CLAccessor.h" |
| 29 | #include "tests/PaddingCalculator.h" |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 30 | #include "tests/datasets/DirectConvolutionLayerDataset.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 31 | #include "tests/datasets/ShapeDatasets.h" |
| 32 | #include "tests/framework/Asserts.h" |
| 33 | #include "tests/framework/Macros.h" |
| 34 | #include "tests/framework/datasets/Datasets.h" |
| 35 | #include "tests/validation/Validation.h" |
| 36 | #include "tests/validation/fixtures/DirectConvolutionLayerFixture.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 37 | |
| 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
Giorgio Arena | 89de118 | 2021-02-04 15:59:03 +0000 | [diff] [blame] | 46 | RelativeTolerance<half> tolerance_fp16(half(0.2)); /**< Tolerance for floating point tests */ |
| 47 | RelativeTolerance<float> tolerance_fp32(0.05f); /**< Tolerance for floating point tests */ |
| 48 | constexpr float tolerance_num = 0.07f; /**< Tolerance number */ |
| 49 | constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance for quantized tests */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 50 | |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 51 | const auto data_strides = combine(framework::dataset::make("StrideX", 1, 3), framework::dataset::make("StrideY", 1, 3)); |
| 52 | const auto data_strides_small = combine(framework::dataset::make("StrideX", 1), framework::dataset::make("StrideY", 1)); |
| 53 | const auto data_ksize_one = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 1))); |
| 54 | const auto data_ksize_one_small = combine(framework::dataset::make("PadX", 0), combine(framework::dataset::make("PadY", 0), framework::dataset::make("KernelSize", 1))); |
| 55 | const auto data_ksize_three = combine(framework::dataset::make("PadX", 0, 2), combine(framework::dataset::make("PadY", 0, 2), framework::dataset::make("KernelSize", 3))); |
| 56 | const auto data_ksize_five = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 5))); |
| 57 | const auto data_ksize_nine = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 9))); |
| 58 | const auto data_ksize_nine_small = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 9))); |
Michalis Spyrou | def665a | 2017-08-14 11:26:37 +0100 | [diff] [blame] | 59 | |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 60 | const auto data_all_kernels = concat(concat(data_ksize_one, data_ksize_three), data_ksize_five); |
| 61 | |
| 62 | const auto data = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_all_kernels)); |
| 63 | const auto data9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_ksize_nine)); |
| 64 | const auto data_small = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_one_small)); |
| 65 | const auto data_small9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_nine_small)); |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 66 | |
| 67 | /** Direct convolution nightly data set. */ |
Michele Di Giorgio | ba2cc1a | 2020-07-15 17:39:30 +0100 | [diff] [blame] | 68 | const auto data_nightly = combine(data, framework::dataset::make("NumKernels", { 1, 4 })); |
| 69 | const auto data_nightly_9x9 = combine(data9x9, framework::dataset::make("NumKernels", { 1, 4 })); |
| 70 | const auto data_nightly_usecase = combine(framework::dataset::make("InputShape", { TensorShape{ 3U, 800U, 800U } }), |
| 71 | combine(framework::dataset::make("StrideX", { 1 }), |
| 72 | combine(framework::dataset::make("StrideY", { 1 }), |
| 73 | combine(framework::dataset::make("PadX", { 4 }), |
| 74 | combine(framework::dataset::make("PadY", { 4 }), |
| 75 | combine(framework::dataset::make("KernelSize", 9), |
| 76 | framework::dataset::make("NumKernels", { 16 }))))))); |
| 77 | |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 78 | /** Direct convolution precommit data set. */ |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 79 | const auto data_precommit = combine(data_small, framework::dataset::make("NumKernels", { 1 })); |
| 80 | const auto data_precommit_9x9 = combine(data_small9x9, framework::dataset::make("NumKernels", { 1 })); |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 81 | |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 82 | /** Activation function Dataset*/ |
| 83 | const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
Michalis Spyrou | 5ce99a2 | 2019-01-25 14:17:49 +0000 | [diff] [blame] | 84 | { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) }); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 85 | } // namespace |
| 86 | |
| 87 | TEST_SUITE(CL) |
| 88 | TEST_SUITE(DirectConvolutionLayer) |
| 89 | |
Michele Di Giorgio | 97e2580 | 2021-03-25 12:37:45 +0000 | [diff] [blame] | 90 | /** Check whether the configuration of a Direct Convolution layer with no |
| 91 | * bias leads to a successful execution. |
| 92 | */ |
| 93 | TEST_CASE(NoBias, framework::DatasetMode::PRECOMMIT) |
| 94 | { |
| 95 | const auto src_shape = TensorShape(27U, 13U, 2U); |
| 96 | const auto weights_shape = TensorShape(3U, 3U, 2U, 4U); |
| 97 | const auto bias_shape = TensorShape(4U); |
| 98 | const auto dst_shape = TensorShape(25U, 11U, 4U); |
| 99 | constexpr auto dt = DataType::F32; |
| 100 | |
| 101 | auto src = create_tensor<CLTensor>(src_shape, dt); |
| 102 | auto weights = create_tensor<CLTensor>(weights_shape, dt); |
| 103 | auto dst = create_tensor<CLTensor>(dst_shape, dt); |
| 104 | |
| 105 | const auto conv_info = PadStrideInfo(1, 1, 0, 0); |
| 106 | |
| 107 | // Create Direct Convolution function |
| 108 | CLDirectConvolutionLayer conv{}; |
| 109 | conv.configure(&src, &weights, nullptr, &dst, conv_info); |
| 110 | |
| 111 | src.allocator()->allocate(); |
| 112 | weights.allocator()->allocate(); |
| 113 | dst.allocator()->allocate(); |
| 114 | |
| 115 | library->fill_tensor_value(CLAccessor(src), 1.f); |
| 116 | library->fill_tensor_value(CLAccessor(weights), 1.f); |
| 117 | |
| 118 | conv.run(); |
| 119 | |
| 120 | // Compute reference to compare |
| 121 | SimpleTensor<float> ref_src{ src_shape, dt }; |
| 122 | SimpleTensor<float> ref_weights{ weights_shape, dt }; |
| 123 | SimpleTensor<float> ref_bias{ bias_shape, dt }; |
| 124 | library->fill_tensor_value(ref_src, 1.f); |
| 125 | library->fill_tensor_value(ref_weights, 1.f); |
| 126 | // No bias |
| 127 | library->fill_tensor_value(ref_bias, 0.f); |
| 128 | auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias, dst_shape, conv_info); |
| 129 | |
| 130 | validate(CLAccessor(dst), ref_dst); |
| 131 | } |
| 132 | |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 133 | // *INDENT-OFF* |
| 134 | // clang-format off |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 135 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 136 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights |
| 137 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching input feature maps |
| 138 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported kernel width |
| 139 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non-rectangular weights dimensions |
| 140 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights dimensions |
| 141 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid stride |
| 142 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size |
| 143 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions |
| 144 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size |
| 145 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink |
| 146 | TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 147 | }), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 148 | framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16), |
| 149 | TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32), |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 150 | TensorInfo(TensorShape(11U, 11U, 2U, 4U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 151 | TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32), |
| 152 | TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32), |
| 153 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 154 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 155 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 156 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 157 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 158 | TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 159 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 160 | framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 161 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 162 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 163 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 164 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 165 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 166 | TensorInfo(TensorShape(3U), 1, DataType::F32), |
| 167 | TensorInfo(TensorShape(4U, 2U), 1, DataType::F32), |
| 168 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 169 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 170 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 171 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 172 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 173 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 174 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 175 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 176 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 177 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 178 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 179 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 180 | TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32), |
| 181 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 182 | TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 183 | })), |
| 184 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 185 | PadStrideInfo(1, 1, 0, 0), |
| 186 | PadStrideInfo(1, 1, 0, 0), |
| 187 | PadStrideInfo(1, 1, 0, 0), |
| 188 | PadStrideInfo(1, 1, 0, 0), |
| 189 | PadStrideInfo(3, 3, 0, 0), |
| 190 | PadStrideInfo(1, 1, 0, 0), |
| 191 | PadStrideInfo(1, 1, 0, 0), |
| 192 | PadStrideInfo(1, 1, 0, 0), |
| 193 | PadStrideInfo(1, 1, 0, 0), |
Giorgio Arena | 5948634 | 2017-12-01 10:42:47 +0000 | [diff] [blame] | 194 | PadStrideInfo(1, 1, 0, 0), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 195 | })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 196 | framework::dataset::make("ActivationInfo", |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 197 | { |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 198 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) |
| 199 | })), |
| 200 | framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true })), |
| 201 | input_info, weights_info, biases_info, output_info, conv_info, act_info, expected) |
| 202 | { |
| 203 | bool is_valid = bool(CLDirectConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, act_info)); |
Georgios Pinitas | 631c41a | 2017-12-06 11:53:03 +0000 | [diff] [blame] | 204 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 205 | } |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 206 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 207 | template <typename T> |
| 208 | using CLDirectConvolutionLayerFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 209 | template <typename T> |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 210 | using CLDirectConvolutionLayerMixedDataLayoutFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>; |
| 211 | template <typename T> |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 212 | using CLDirectConvolutionValidationWithTensorShapesFixture = DirectConvolutionValidationWithTensorShapesFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 213 | template <typename T> |
| 214 | using CLDirectConvolutionLayerQuantizedFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
| 215 | template <typename T> |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 216 | using CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>; |
| 217 | template <typename T> |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 218 | using CLDirectConvolutionValidationWithTensorShapesQuantizedFixture = DirectConvolutionValidationWithTensorShapesQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 219 | |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 220 | TEST_SUITE(NHWC) |
| 221 | TEST_SUITE(FP16) |
| 222 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, |
| 223 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 224 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 225 | TensorShape(19U, 5U, 16U, 4U), |
| 226 | TensorShape(13U, 5U, 17U, 2U), |
| 227 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 228 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 229 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 230 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 231 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 232 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
Gian Marco Iodice | 5c9eed8 | 2021-03-19 11:26:20 +0000 | [diff] [blame] | 233 | framework::dataset::make("NumKernels", { 17, 3, 1, 19 })), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 234 | framework::dataset::make("DataType", DataType::F16)), |
| 235 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 236 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 237 | { |
| 238 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
| 239 | } |
| 240 | |
| 241 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, |
| 242 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 243 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 244 | framework::dataset::make("StrideX", { 1 })), |
| 245 | framework::dataset::make("StrideY", { 1 })), |
| 246 | framework::dataset::make("PadX", { 1 })), |
| 247 | framework::dataset::make("PadY", { 1 })), |
| 248 | framework::dataset::make("KernelSize", { 9 })), |
| 249 | framework::dataset::make("NumKernels", { 3 })), |
| 250 | framework::dataset::make("DataType", DataType::F16)), |
| 251 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )), |
| 252 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 253 | { |
| 254 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
| 255 | } |
| 256 | |
| 257 | TEST_SUITE_END() // FP16 |
| 258 | |
| 259 | TEST_SUITE(FP32) |
| 260 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 261 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 262 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 263 | TensorShape(19U, 5U, 16U, 4U), |
| 264 | TensorShape(13U, 5U, 17U, 2U), |
| 265 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 266 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 267 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 268 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 269 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 270 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
Gian Marco Iodice | 5c9eed8 | 2021-03-19 11:26:20 +0000 | [diff] [blame] | 271 | framework::dataset::make("NumKernels", { 17, 3, 1, 19 })), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 272 | framework::dataset::make("DataType", DataType::F32)), |
| 273 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 274 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 275 | { |
| 276 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 277 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 278 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 279 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 280 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 281 | TensorShape(19U, 5U, 16U, 4U), |
| 282 | TensorShape(13U, 5U, 17U, 2U), |
| 283 | TensorShape(32U, 37U, 13U) } ), |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 284 | framework::dataset::make("StrideX", { 1 })), |
| 285 | framework::dataset::make("StrideY", { 2 })), |
| 286 | framework::dataset::make("PadX", { 1 })), |
| 287 | framework::dataset::make("PadY", { 3 })), |
| 288 | framework::dataset::make("KernelSize", { 3 })), |
| 289 | framework::dataset::make("NumKernels", { 3 })), |
| 290 | framework::dataset::make("DataType", DataType::F32)), |
| 291 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 292 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 293 | { |
| 294 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 295 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 296 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 297 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 298 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 299 | framework::dataset::make("StrideX", { 1 })), |
| 300 | framework::dataset::make("StrideY", { 1 })), |
| 301 | framework::dataset::make("PadX", { 1 })), |
| 302 | framework::dataset::make("PadY", { 1 })), |
| 303 | framework::dataset::make("KernelSize", { 9 })), |
| 304 | framework::dataset::make("NumKernels", { 3 })), |
| 305 | framework::dataset::make("DataType", DataType::F32)), |
| 306 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )), |
| 307 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 308 | { |
| 309 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 310 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 311 | TEST_SUITE_END() // FP32 |
| 312 | |
| 313 | TEST_SUITE(Quantized) |
| 314 | TEST_SUITE(QASYMM8) |
| 315 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 316 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 317 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 318 | TensorShape(19U, 5U, 16U, 4U), |
| 319 | TensorShape(13U, 5U, 17U, 2U), |
| 320 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 321 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 322 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 323 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 324 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 325 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
| 326 | framework::dataset::make("NumKernels", { 7, 3, 1, 3 })), |
| 327 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 328 | framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))), |
| 329 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 330 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 331 | { |
| 332 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 333 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 334 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 335 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 336 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 337 | TensorShape(19U, 5U, 16U, 4U), |
| 338 | TensorShape(13U, 5U, 17U, 2U), |
| 339 | TensorShape(32U, 37U, 13U) } ), |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 340 | framework::dataset::make("StrideX", { 1 })), |
| 341 | framework::dataset::make("StrideY", { 2 })), |
| 342 | framework::dataset::make("PadX", { 1 })), |
| 343 | framework::dataset::make("PadY", { 1 })), |
| 344 | framework::dataset::make("KernelSize", { 3 })), |
| 345 | framework::dataset::make("NumKernels", { 3 })), |
| 346 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 347 | framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))), |
| 348 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 349 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 350 | { |
| 351 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 352 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 353 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 354 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 355 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 356 | framework::dataset::make("StrideX", { 1 })), |
| 357 | framework::dataset::make("StrideY", { 1 })), |
| 358 | framework::dataset::make("PadX", { 1 })), |
| 359 | framework::dataset::make("PadY", { 1 })), |
| 360 | framework::dataset::make("KernelSize", { 9 })), |
| 361 | framework::dataset::make("NumKernels", { 3 })), |
| 362 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 363 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 364 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 365 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 366 | { |
| 367 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 368 | } |
| 369 | |
| 370 | TEST_SUITE_END() // QASYMM8 |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 371 | TEST_SUITE(QASYMM8_SIGNED) |
| 372 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 373 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 374 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 375 | TensorShape(19U, 5U, 16U, 4U), |
| 376 | TensorShape(13U, 5U, 17U, 2U), |
| 377 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 378 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 379 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 380 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 381 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 382 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
| 383 | framework::dataset::make("NumKernels", { 7, 3, 1, 3 })), |
| 384 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 385 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 386 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 387 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 388 | { |
| 389 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 390 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 391 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 392 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 393 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 394 | TensorShape(19U, 5U, 16U, 4U), |
| 395 | TensorShape(13U, 5U, 17U, 2U), |
| 396 | TensorShape(32U, 37U, 13U) } ), |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 397 | framework::dataset::make("StrideX", { 1 })), |
| 398 | framework::dataset::make("StrideY", { 1 })), |
| 399 | framework::dataset::make("PadX", { 1 })), |
| 400 | framework::dataset::make("PadY", { 1 })), |
| 401 | framework::dataset::make("KernelSize", { 3 })), |
| 402 | framework::dataset::make("NumKernels", { 3 })), |
| 403 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 404 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 405 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 406 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 407 | { |
| 408 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 409 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 410 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
| 411 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 412 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 413 | framework::dataset::make("StrideX", { 1 })), |
| 414 | framework::dataset::make("StrideY", { 1 })), |
| 415 | framework::dataset::make("PadX", { 1 })), |
| 416 | framework::dataset::make("PadY", { 1 })), |
| 417 | framework::dataset::make("KernelSize", { 9 })), |
| 418 | framework::dataset::make("NumKernels", { 3 })), |
| 419 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 420 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 421 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 422 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 423 | { |
| 424 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 425 | } |
| 426 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 427 | TEST_SUITE_END() // Quantized |
| 428 | TEST_SUITE_END() // NHWC |
| 429 | |
| 430 | // clang-format on |
| 431 | // *INDENT-ON* |
| 432 | TEST_SUITE(NCHW) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 433 | TEST_SUITE(Float) |
| 434 | TEST_SUITE(FP16) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 435 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", DataType::F16)), |
| 436 | ActivationFunctionsDataset), |
| 437 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 438 | { |
| 439 | // Validate output |
steniu01 | 3e05e4e | 2017-08-25 17:18:01 +0100 | [diff] [blame] | 440 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 441 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 442 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F16)), |
| 443 | ActivationFunctionsDataset), |
| 444 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
| 445 | { |
| 446 | // Validate output |
| 447 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
| 448 | } |
| 449 | TEST_SUITE_END() // FP16 |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 450 | |
| 451 | TEST_SUITE(FP32) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 452 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", |
| 453 | DataType::F32)), |
| 454 | ActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 455 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 456 | { |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 457 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 458 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 459 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", |
| 460 | DataType::F32)), |
| 461 | ActivationFunctionsDataset), |
| 462 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 463 | { |
| 464 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 465 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 466 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F32)), |
| 467 | ActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 468 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 469 | { |
| 470 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 471 | } |
| 472 | TEST_SUITE_END() // FP32 |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 473 | |
| 474 | TEST_SUITE(FP32_CustomDataset) |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 475 | FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::DirectConvolutionLayerDataset(), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 476 | framework::dataset::make("DataType", DataType::F32)), |
| 477 | ActivationFunctionsDataset)) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 478 | { |
| 479 | // Validate output |
| 480 | validate(CLAccessor(_target), _reference, tolerance_fp32); |
| 481 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 482 | TEST_SUITE_END() // FP32_CustomDataset |
| 483 | TEST_SUITE_END() // Float |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 484 | |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 485 | const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 486 | { |
| 487 | ActivationLayerInfo(), |
| 488 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 489 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f) |
| 490 | }); |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 491 | TEST_SUITE(Quantized) |
| 492 | TEST_SUITE(QASYMM8) |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 493 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit, |
| 494 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 495 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10)})), |
| 496 | QuantizedActivationFunctionsDataset), |
| 497 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 498 | { |
| 499 | // Validate output |
| 500 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 501 | } |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 502 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit, |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 503 | framework::dataset::make("DataType", DataType::QASYMM8)), |
Michele Di Giorgio | 14cbfb2 | 2019-10-23 10:53:10 +0100 | [diff] [blame] | 504 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })), |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 505 | QuantizedActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 506 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sang-Hoon Park | ab5b1a2 | 2019-10-15 09:29:13 +0100 | [diff] [blame] | 507 | { |
| 508 | // Validate output |
| 509 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 510 | } |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 511 | FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit_9x9, |
| 512 | framework::dataset::make("DataType", |
| 513 | DataType::QASYMM8)), |
Manuel Bottini | 136174a | 2020-11-24 13:04:19 +0000 | [diff] [blame] | 514 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) })), |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 515 | QuantizedActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 516 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 517 | { |
| 518 | // Validate output |
| 519 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 520 | } |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 521 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(data_nightly, framework::dataset::make("DataType", |
Sang-Hoon Park | ab5b1a2 | 2019-10-15 09:29:13 +0100 | [diff] [blame] | 522 | DataType::QASYMM8)), |
Michele Di Giorgio | 14cbfb2 | 2019-10-23 10:53:10 +0100 | [diff] [blame] | 523 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })), |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 524 | QuantizedActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 525 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 526 | { |
| 527 | // Validate output |
| 528 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 529 | } |
| 530 | FIXTURE_DATA_TEST_CASE(RunLarge9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(data_nightly_9x9, |
| 531 | framework::dataset::make("DataType", |
| 532 | DataType::QASYMM8)), |
Manuel Bottini | 136174a | 2020-11-24 13:04:19 +0000 | [diff] [blame] | 533 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) })), |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 534 | QuantizedActivationFunctionsDataset), |
| 535 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sang-Hoon Park | ab5b1a2 | 2019-10-15 09:29:13 +0100 | [diff] [blame] | 536 | { |
| 537 | // Validate output |
| 538 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 539 | } |
| 540 | |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 541 | TEST_SUITE_END() // QASYMM8 |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 542 | |
| 543 | TEST_SUITE(QASYMM8_CustomDataset) |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 544 | FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 545 | combine(combine(combine(combine(datasets::DirectConvolutionLayerDataset(), |
| 546 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 547 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) })), |
| 548 | QuantizedActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 549 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 550 | { |
| 551 | // Validate output |
| 552 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 553 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 554 | TEST_SUITE_END() // QASYMM8_CustomDataset |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 555 | |
| 556 | TEST_SUITE(QASYMM8_SIGNED) |
| 557 | |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 558 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit, framework::dataset::make("DataType", |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 559 | DataType::QASYMM8_SIGNED)), |
| 560 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, -10) })), |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 561 | QuantizedActivationFunctionsDataset), |
| 562 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 563 | { |
| 564 | // Validate output |
| 565 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 566 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 567 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit, framework::dataset::make("DataType", |
| 568 | DataType::QASYMM8_SIGNED)), |
| 569 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.1f, -10) })), |
| 570 | QuantizedActivationFunctionsDataset), |
| 571 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 572 | { |
| 573 | // Validate output |
| 574 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 575 | } |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 576 | FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit_9x9, |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 577 | framework::dataset::make("DataType", |
| 578 | DataType::QASYMM8_SIGNED)), |
| 579 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })), |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 580 | QuantizedActivationFunctionsDataset), |
| 581 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 582 | { |
| 583 | // Validate output |
| 584 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 585 | } |
| 586 | |
| 587 | FIXTURE_DATA_TEST_CASE(RunCustomDataset, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 588 | combine(combine(combine(combine(datasets::DirectConvolutionLayerDataset(), |
| 589 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 590 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) })), |
| 591 | QuantizedActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 592 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 593 | { |
| 594 | // Validate output |
| 595 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 596 | } |
| 597 | |
| 598 | TEST_SUITE_END() // QASYMM8_SIGNED |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 599 | TEST_SUITE_END() // Quantized |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 600 | TEST_SUITE_END() // NCHW |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 601 | TEST_SUITE_END() // DirectConvolutionLayer |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 602 | TEST_SUITE_END() // CL |
| 603 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 604 | } // namespace validation |
| 605 | } // namespace test |
Anthony Barbier | 1c0d0ff | 2018-01-31 13:05:09 +0000 | [diff] [blame] | 606 | } // namespace arm_compute |