blob: f026bfe0b018029e9e9a1155c0725ed62040ba0e [file] [log] [blame]
Moritz Pflanzerb3d25792017-07-26 11:49:37 +01001/*
Ramy Elgammal73f19af2022-10-23 11:44:49 +01002 * Copyright (c) 2017-2022 Arm Limited.
Moritz Pflanzerb3d25792017-07-26 11:49:37 +01003 *
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 Pflanzerb3d25792017-07-26 11:49:37 +010028#include "tests/CL/CLAccessor.h"
29#include "tests/PaddingCalculator.h"
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +000030#include "tests/datasets/DirectConvolutionLayerDataset.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010031#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 Pflanzerb3d25792017-07-26 11:49:37 +010037
38namespace arm_compute
39{
40namespace test
41{
42namespace validation
43{
44namespace
45{
Gunes Bayir38ce29d2021-08-04 12:45:33 +010046RelativeTolerance<half> tolerance_fp16(half(0.2)); /**< Tolerance for floating point tests */
47RelativeTolerance<float> tolerance_fp32(0.05f); /**< Tolerance for floating point tests */
48constexpr float abs_tolerance_f32(0.0001f); /**< Absolute tolerance for FP32 tests*/
49
50constexpr float tolerance_num = 0.07f; /**< Tolerance number */
51constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance for quantized tests */
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010052
Michalis Spyrou45091732019-05-13 17:41:01 +010053const auto data_strides = combine(framework::dataset::make("StrideX", 1, 3), framework::dataset::make("StrideY", 1, 3));
54const auto data_strides_small = combine(framework::dataset::make("StrideX", 1), framework::dataset::make("StrideY", 1));
55const auto data_ksize_one = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 1)));
56const auto data_ksize_one_small = combine(framework::dataset::make("PadX", 0), combine(framework::dataset::make("PadY", 0), framework::dataset::make("KernelSize", 1)));
57const auto data_ksize_three = combine(framework::dataset::make("PadX", 0, 2), combine(framework::dataset::make("PadY", 0, 2), framework::dataset::make("KernelSize", 3)));
58const auto data_ksize_five = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 5)));
59const auto data_ksize_nine = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 9)));
60const 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 Spyroudef665a2017-08-14 11:26:37 +010061
Michalis Spyrou45091732019-05-13 17:41:01 +010062const auto data_all_kernels = concat(concat(data_ksize_one, data_ksize_three), data_ksize_five);
63
64const auto data = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_all_kernels));
65const auto data9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_ksize_nine));
66const auto data_small = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_one_small));
67const auto data_small9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_nine_small));
Michalis Spyrou064add62018-11-01 18:14:27 +000068
69/** Direct convolution nightly data set. */
Michele Di Giorgioba2cc1a2020-07-15 17:39:30 +010070const auto data_nightly = combine(data, framework::dataset::make("NumKernels", { 1, 4 }));
71const auto data_nightly_9x9 = combine(data9x9, framework::dataset::make("NumKernels", { 1, 4 }));
72const auto data_nightly_usecase = combine(framework::dataset::make("InputShape", { TensorShape{ 3U, 800U, 800U } }),
73 combine(framework::dataset::make("StrideX", { 1 }),
74 combine(framework::dataset::make("StrideY", { 1 }),
75 combine(framework::dataset::make("PadX", { 4 }),
76 combine(framework::dataset::make("PadY", { 4 }),
77 combine(framework::dataset::make("KernelSize", 9),
78 framework::dataset::make("NumKernels", { 16 })))))));
79
Michalis Spyrou064add62018-11-01 18:14:27 +000080/** Direct convolution precommit data set. */
Michalis Spyrou45091732019-05-13 17:41:01 +010081const auto data_precommit = combine(data_small, framework::dataset::make("NumKernels", { 1 }));
82const auto data_precommit_9x9 = combine(data_small9x9, framework::dataset::make("NumKernels", { 1 }));
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010083
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000084/** Activation function Dataset*/
85const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
Michalis Spyrou5ce99a22019-01-25 14:17:49 +000086{ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) });
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010087} // namespace
88
89TEST_SUITE(CL)
90TEST_SUITE(DirectConvolutionLayer)
91
Michele Di Giorgio97e25802021-03-25 12:37:45 +000092/** Check whether the configuration of a Direct Convolution layer with no
93 * bias leads to a successful execution.
94 */
95TEST_CASE(NoBias, framework::DatasetMode::PRECOMMIT)
96{
97 const auto src_shape = TensorShape(27U, 13U, 2U);
98 const auto weights_shape = TensorShape(3U, 3U, 2U, 4U);
99 const auto bias_shape = TensorShape(4U);
100 const auto dst_shape = TensorShape(25U, 11U, 4U);
101 constexpr auto dt = DataType::F32;
102
103 auto src = create_tensor<CLTensor>(src_shape, dt);
104 auto weights = create_tensor<CLTensor>(weights_shape, dt);
105 auto dst = create_tensor<CLTensor>(dst_shape, dt);
106
107 const auto conv_info = PadStrideInfo(1, 1, 0, 0);
108
109 // Create Direct Convolution function
110 CLDirectConvolutionLayer conv{};
111 conv.configure(&src, &weights, nullptr, &dst, conv_info);
112
113 src.allocator()->allocate();
114 weights.allocator()->allocate();
115 dst.allocator()->allocate();
116
117 library->fill_tensor_value(CLAccessor(src), 1.f);
118 library->fill_tensor_value(CLAccessor(weights), 1.f);
119
120 conv.run();
121
122 // Compute reference to compare
123 SimpleTensor<float> ref_src{ src_shape, dt };
124 SimpleTensor<float> ref_weights{ weights_shape, dt };
125 SimpleTensor<float> ref_bias{ bias_shape, dt };
126 library->fill_tensor_value(ref_src, 1.f);
127 library->fill_tensor_value(ref_weights, 1.f);
128 // No bias
129 library->fill_tensor_value(ref_bias, 0.f);
130 auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias, dst_shape, conv_info);
131
132 validate(CLAccessor(dst), ref_dst);
133}
134
Ramy Elgammal73f19af2022-10-23 11:44:49 +0100135/** Check whether the case of rectangle kernels i.e. when width and height of the weight_shape are not equal
136 * would lead to successful run
137 */
138TEST_CASE(NonSquareKernel, framework::DatasetMode::PRECOMMIT)
139{
140 auto src_shape = TensorShape(33U, 27U, 3U);
141 auto weights_shape = TensorShape(5U, 7U, 3U, 4U); // non-square kernel
142 const auto bias_shape = TensorShape(4U);
143 auto dst_shape = TensorShape(11U, 12U, 4U);
144 constexpr auto dt = DataType::F32;
145
146 TensorShape src_shape_nhwc(src_shape);
147 TensorShape weights_shape_nhwc(weights_shape);
148 TensorShape dst_shape_nhwc(dst_shape);
149
150 // Non-square shapes are only allowed for NHWC
151 permute(src_shape_nhwc, PermutationVector(2U, 0U, 1U));
152 permute(weights_shape_nhwc, PermutationVector(2U, 0U, 1U));
153 permute(dst_shape_nhwc, PermutationVector(2U, 0U, 1U));
154
155 auto src = create_tensor<CLTensor>(src_shape_nhwc, dt, 1, QuantizationInfo(), DataLayout::NHWC);
156 auto weights = create_tensor<CLTensor>(weights_shape_nhwc, dt, 1, QuantizationInfo(), DataLayout::NHWC);
157 auto dst = create_tensor<CLTensor>(dst_shape_nhwc, dt, 1, QuantizationInfo(), DataLayout::NHWC);
158 const auto conv_info = PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR);
159
160 // Create direct convolution function
161 CLDirectConvolutionLayer conv{};
162 conv.configure(&src, &weights, nullptr, &dst, conv_info);
163
164 src.allocator()->allocate();
165 weights.allocator()->allocate();
166 dst.allocator()->allocate();
167
168 library->fill_tensor_value(CLAccessor(src), 1.f);
169 library->fill_tensor_value(CLAccessor(weights), 1.f);
170
171 conv.run();
172
173 // Compute reference to compare
174 SimpleTensor<float> ref_src{ src_shape, dt };
175 SimpleTensor<float> ref_weights{ weights_shape, dt };
176 SimpleTensor<float> ref_bias{ bias_shape, dt };
177 library->fill_tensor_value(ref_src, 1.f);
178 library->fill_tensor_value(ref_weights, 1.f);
179 // No bias
180 library->fill_tensor_value(ref_bias, 0.f);
181 auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias, dst_shape, conv_info);
182
183 validate(CLAccessor(dst), ref_dst);
184}
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000185// *INDENT-OFF*
186// clang-format off
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000187DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100188 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
189 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching input feature maps
190 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported kernel width
191 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non-rectangular weights dimensions
192 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights dimensions
193 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid stride
194 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
195 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
196 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
197 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
198 TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000199 }),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100200 framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16),
201 TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32),
Michalis Spyrou45091732019-05-13 17:41:01 +0100202 TensorInfo(TensorShape(11U, 11U, 2U, 4U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100203 TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32),
204 TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32),
205 TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
206 TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
207 TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
208 TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
209 TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
210 TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32),
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000211 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100212 framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32),
213 TensorInfo(TensorShape(4U), 1, DataType::F32),
214 TensorInfo(TensorShape(4U), 1, DataType::F32),
215 TensorInfo(TensorShape(4U), 1, DataType::F32),
216 TensorInfo(TensorShape(4U), 1, DataType::F32),
217 TensorInfo(TensorShape(4U), 1, DataType::F32),
218 TensorInfo(TensorShape(3U), 1, DataType::F32),
219 TensorInfo(TensorShape(4U, 2U), 1, DataType::F32),
220 TensorInfo(TensorShape(4U), 1, DataType::F32),
221 TensorInfo(TensorShape(4U), 1, DataType::F32),
222 TensorInfo(TensorShape(4U), 1, DataType::F32),
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000223 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100224 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
225 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
226 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
227 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
228 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
229 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
230 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
231 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
232 TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32),
233 TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
234 TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32),
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000235 })),
236 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
237 PadStrideInfo(1, 1, 0, 0),
238 PadStrideInfo(1, 1, 0, 0),
239 PadStrideInfo(1, 1, 0, 0),
240 PadStrideInfo(1, 1, 0, 0),
241 PadStrideInfo(3, 3, 0, 0),
242 PadStrideInfo(1, 1, 0, 0),
243 PadStrideInfo(1, 1, 0, 0),
244 PadStrideInfo(1, 1, 0, 0),
245 PadStrideInfo(1, 1, 0, 0),
Giorgio Arena59486342017-12-01 10:42:47 +0000246 PadStrideInfo(1, 1, 0, 0),
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000247 })),
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000248 framework::dataset::make("ActivationInfo",
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000249{
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000250 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)
251})),
252 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true })),
253 input_info, weights_info, biases_info, output_info, conv_info, act_info, expected)
254{
255 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 Pinitas631c41a2017-12-06 11:53:03 +0000256 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000257}
Georgios Pinitas30902ed2017-11-14 15:32:57 +0000258
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100259template <typename T>
260using CLDirectConvolutionLayerFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000261template <typename T>
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000262using CLDirectConvolutionLayerMixedDataLayoutFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>;
263template <typename T>
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000264using CLDirectConvolutionValidationWithTensorShapesFixture = DirectConvolutionValidationWithTensorShapesFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000265template <typename T>
266using CLDirectConvolutionLayerQuantizedFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
267template <typename T>
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000268using CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>;
269template <typename T>
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000270using CLDirectConvolutionValidationWithTensorShapesQuantizedFixture = DirectConvolutionValidationWithTensorShapesQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100271
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000272TEST_SUITE(NHWC)
273TEST_SUITE(FP16)
274FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT,
275 combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100276 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
277 TensorShape(19U, 5U, 16U, 4U),
278 TensorShape(13U, 5U, 17U, 2U),
279 TensorShape(32U, 37U, 13U) } ),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000280 framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
281 framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
282 framework::dataset::make("PadX", { 1, 3, 0, 4 })),
283 framework::dataset::make("PadY", { 1, 3, 0, 4 })),
284 framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000285 framework::dataset::make("NumKernels", { 17, 3, 1, 19 })),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000286 framework::dataset::make("DataType", DataType::F16)),
287 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
288 framework::dataset::make("DataLayout", DataLayout::NHWC)))
289{
290 validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
291}
292
293FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
294 combine(combine(combine(zip(zip(zip(zip(zip(zip(
295 framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
296 framework::dataset::make("StrideX", { 1 })),
297 framework::dataset::make("StrideY", { 1 })),
298 framework::dataset::make("PadX", { 1 })),
299 framework::dataset::make("PadY", { 1 })),
300 framework::dataset::make("KernelSize", { 9 })),
301 framework::dataset::make("NumKernels", { 3 })),
302 framework::dataset::make("DataType", DataType::F16)),
303 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )),
304 framework::dataset::make("DataLayout", DataLayout::NHWC)))
305{
306 validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
307}
308
309TEST_SUITE_END() // FP16
310
311TEST_SUITE(FP32)
312FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
313 combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100314 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
315 TensorShape(19U, 5U, 16U, 4U),
316 TensorShape(13U, 5U, 17U, 2U),
317 TensorShape(32U, 37U, 13U) } ),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000318 framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
319 framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
320 framework::dataset::make("PadX", { 1, 3, 0, 4 })),
321 framework::dataset::make("PadY", { 1, 3, 0, 4 })),
322 framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000323 framework::dataset::make("NumKernels", { 17, 3, 1, 19 })),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000324 framework::dataset::make("DataType", DataType::F32)),
325 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
326 framework::dataset::make("DataLayout", DataLayout::NHWC)))
327{
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100328 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000329}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000330FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT,
331 combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100332 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
333 TensorShape(19U, 5U, 16U, 4U),
334 TensorShape(13U, 5U, 17U, 2U),
335 TensorShape(32U, 37U, 13U) } ),
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000336 framework::dataset::make("StrideX", { 1 })),
337 framework::dataset::make("StrideY", { 2 })),
338 framework::dataset::make("PadX", { 1 })),
339 framework::dataset::make("PadY", { 3 })),
340 framework::dataset::make("KernelSize", { 3 })),
341 framework::dataset::make("NumKernels", { 3 })),
342 framework::dataset::make("DataType", DataType::F32)),
343 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
344 framework::dataset::make("DataLayout", DataLayout::NHWC)))
345{
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100346 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000347}
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000348FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
349 combine(combine(combine(zip(zip(zip(zip(zip(zip(
350 framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
351 framework::dataset::make("StrideX", { 1 })),
352 framework::dataset::make("StrideY", { 1 })),
353 framework::dataset::make("PadX", { 1 })),
354 framework::dataset::make("PadY", { 1 })),
355 framework::dataset::make("KernelSize", { 9 })),
356 framework::dataset::make("NumKernels", { 3 })),
357 framework::dataset::make("DataType", DataType::F32)),
358 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )),
359 framework::dataset::make("DataLayout", DataLayout::NHWC)))
360{
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100361 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000362}
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000363TEST_SUITE_END() // FP32
364
365TEST_SUITE(Quantized)
366TEST_SUITE(QASYMM8)
367FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
368 combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100369 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
370 TensorShape(19U, 5U, 16U, 4U),
371 TensorShape(13U, 5U, 17U, 2U),
372 TensorShape(32U, 37U, 13U) } ),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000373 framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
374 framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
375 framework::dataset::make("PadX", { 1, 3, 0, 4 })),
376 framework::dataset::make("PadY", { 1, 3, 0, 4 })),
377 framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
378 framework::dataset::make("NumKernels", { 7, 3, 1, 3 })),
379 framework::dataset::make("DataType", DataType::QASYMM8)),
380 framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))),
381 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
382 framework::dataset::make("DataLayout", DataLayout::NHWC)))
383{
384 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
385}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000386FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
387 combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100388 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
389 TensorShape(19U, 5U, 16U, 4U),
390 TensorShape(13U, 5U, 17U, 2U),
391 TensorShape(32U, 37U, 13U) } ),
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000392 framework::dataset::make("StrideX", { 1 })),
393 framework::dataset::make("StrideY", { 2 })),
394 framework::dataset::make("PadX", { 1 })),
395 framework::dataset::make("PadY", { 1 })),
396 framework::dataset::make("KernelSize", { 3 })),
397 framework::dataset::make("NumKernels", { 3 })),
398 framework::dataset::make("DataType", DataType::QASYMM8)),
399 framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))),
400 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
401 framework::dataset::make("DataLayout", DataLayout::NHWC)))
402{
403 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
404}
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000405FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
406 combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
407 framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
408 framework::dataset::make("StrideX", { 1 })),
409 framework::dataset::make("StrideY", { 1 })),
410 framework::dataset::make("PadX", { 1 })),
411 framework::dataset::make("PadY", { 1 })),
412 framework::dataset::make("KernelSize", { 9 })),
413 framework::dataset::make("NumKernels", { 3 })),
414 framework::dataset::make("DataType", DataType::QASYMM8)),
415 framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
416 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
417 framework::dataset::make("DataLayout", DataLayout::NHWC)))
418{
419 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
420}
421
422TEST_SUITE_END() // QASYMM8
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000423TEST_SUITE(QASYMM8_SIGNED)
424FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
425 combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100426 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
427 TensorShape(19U, 5U, 16U, 4U),
428 TensorShape(13U, 5U, 17U, 2U),
429 TensorShape(32U, 37U, 13U) } ),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000430 framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
431 framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
432 framework::dataset::make("PadX", { 1, 3, 0, 4 })),
433 framework::dataset::make("PadY", { 1, 3, 0, 4 })),
434 framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
435 framework::dataset::make("NumKernels", { 7, 3, 1, 3 })),
436 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
437 framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
438 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
439 framework::dataset::make("DataLayout", DataLayout::NHWC)))
440{
441 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
442}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000443FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
444 combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
Gian Marco Iodice2ba39b62021-05-07 09:21:47 +0100445 framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
446 TensorShape(19U, 5U, 16U, 4U),
447 TensorShape(13U, 5U, 17U, 2U),
448 TensorShape(32U, 37U, 13U) } ),
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000449 framework::dataset::make("StrideX", { 1 })),
450 framework::dataset::make("StrideY", { 1 })),
451 framework::dataset::make("PadX", { 1 })),
452 framework::dataset::make("PadY", { 1 })),
453 framework::dataset::make("KernelSize", { 3 })),
454 framework::dataset::make("NumKernels", { 3 })),
455 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
456 framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
457 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
458 framework::dataset::make("DataLayout", DataLayout::NHWC)))
459{
460 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
461}
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000462FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
463 combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
464 framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
465 framework::dataset::make("StrideX", { 1 })),
466 framework::dataset::make("StrideY", { 1 })),
467 framework::dataset::make("PadX", { 1 })),
468 framework::dataset::make("PadY", { 1 })),
469 framework::dataset::make("KernelSize", { 9 })),
470 framework::dataset::make("NumKernels", { 3 })),
471 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
472 framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
473 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
474 framework::dataset::make("DataLayout", DataLayout::NHWC)))
475{
476 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
477}
478TEST_SUITE_END() // QASYMM8_SIGNED
479TEST_SUITE_END() // Quantized
480TEST_SUITE_END() // NHWC
481
482// clang-format on
483// *INDENT-ON*
484TEST_SUITE(NCHW)
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100485TEST_SUITE(Float)
486TEST_SUITE(FP16)
Michalis Spyrou064add62018-11-01 18:14:27 +0000487FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", DataType::F16)),
488 ActivationFunctionsDataset),
489 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100490{
491 // Validate output
steniu013e05e4e2017-08-25 17:18:01 +0100492 validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100493}
Michalis Spyrou064add62018-11-01 18:14:27 +0000494FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F16)),
495 ActivationFunctionsDataset),
496 framework::dataset::make("DataLayout", DataLayout::NCHW)))
497{
498 // Validate output
499 validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
500}
501TEST_SUITE_END() // FP16
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100502
503TEST_SUITE(FP32)
Michalis Spyrou064add62018-11-01 18:14:27 +0000504FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType",
505 DataType::F32)),
506 ActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000507 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100508{
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100509 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100510}
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100511FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit,
512 framework::dataset::make("DataType",
513 DataType::F32)),
514 ActivationFunctionsDataset),
515 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000516{
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100517 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000518}
Michalis Spyrou064add62018-11-01 18:14:27 +0000519FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F32)),
520 ActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000521 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Michalis Spyrou064add62018-11-01 18:14:27 +0000522{
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100523 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Michalis Spyrou064add62018-11-01 18:14:27 +0000524}
525TEST_SUITE_END() // FP32
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000526
527TEST_SUITE(FP32_CustomDataset)
Michalis Spyrou80943252019-01-10 17:19:50 +0000528FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::DirectConvolutionLayerDataset(),
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000529 framework::dataset::make("DataType", DataType::F32)),
530 ActivationFunctionsDataset))
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000531{
532 // Validate output
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100533 validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000534}
Michalis Spyrou064add62018-11-01 18:14:27 +0000535TEST_SUITE_END() // FP32_CustomDataset
536TEST_SUITE_END() // Float
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100537
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000538const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
539{
540 ActivationLayerInfo(),
541 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
542 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
543});
Chunosovd621bca2017-11-03 17:33:15 +0700544TEST_SUITE(Quantized)
545TEST_SUITE(QASYMM8)
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000546FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit,
547 framework::dataset::make("DataType", DataType::QASYMM8)),
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100548 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10) })),
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000549 QuantizedActivationFunctionsDataset),
550 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
551{
552 // Validate output
553 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
554}
Giorgio Arenae620a832020-02-17 16:33:20 +0000555FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit,
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000556 framework::dataset::make("DataType", DataType::QASYMM8)),
Michele Di Giorgio14cbfb22019-10-23 10:53:10 +0100557 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })),
Giorgio Arenae620a832020-02-17 16:33:20 +0000558 QuantizedActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000559 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Sang-Hoon Parkab5b1a22019-10-15 09:29:13 +0100560{
561 // Validate output
562 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
563}
Giorgio Arenae620a832020-02-17 16:33:20 +0000564FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit_9x9,
565 framework::dataset::make("DataType",
566 DataType::QASYMM8)),
Manuel Bottini136174a2020-11-24 13:04:19 +0000567 framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) })),
Giorgio Arenae620a832020-02-17 16:33:20 +0000568 QuantizedActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000569 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Michalis Spyrou064add62018-11-01 18:14:27 +0000570{
571 // Validate output
572 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
573}
Giorgio Arenae620a832020-02-17 16:33:20 +0000574FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(data_nightly, framework::dataset::make("DataType",
Sang-Hoon Parkab5b1a22019-10-15 09:29:13 +0100575 DataType::QASYMM8)),
Michele Di Giorgio14cbfb22019-10-23 10:53:10 +0100576 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })),
Giorgio Arenae620a832020-02-17 16:33:20 +0000577 QuantizedActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000578 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Giorgio Arenae620a832020-02-17 16:33:20 +0000579{
580 // Validate output
581 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
582}
583FIXTURE_DATA_TEST_CASE(RunLarge9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(data_nightly_9x9,
584 framework::dataset::make("DataType",
585 DataType::QASYMM8)),
Manuel Bottini136174a2020-11-24 13:04:19 +0000586 framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) })),
Giorgio Arenae620a832020-02-17 16:33:20 +0000587 QuantizedActivationFunctionsDataset),
588 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Sang-Hoon Parkab5b1a22019-10-15 09:29:13 +0100589{
590 // Validate output
591 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
592}
593
Michalis Spyrou064add62018-11-01 18:14:27 +0000594TEST_SUITE_END() // QASYMM8
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000595
596TEST_SUITE(QASYMM8_CustomDataset)
Giorgio Arenae620a832020-02-17 16:33:20 +0000597FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
598 combine(combine(combine(combine(datasets::DirectConvolutionLayerDataset(),
599 framework::dataset::make("DataType", DataType::QASYMM8)),
600 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) })),
601 QuantizedActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000602 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Jaroslaw Rzepecki2ecbada2017-11-29 13:51:34 +0000603{
604 // Validate output
605 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
606}
Michalis Spyrou064add62018-11-01 18:14:27 +0000607TEST_SUITE_END() // QASYMM8_CustomDataset
Sheri Zhang681f2d42020-02-20 11:23:08 +0000608
609TEST_SUITE(QASYMM8_SIGNED)
610
Giorgio Arenae620a832020-02-17 16:33:20 +0000611FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit, framework::dataset::make("DataType",
Sheri Zhang681f2d42020-02-20 11:23:08 +0000612 DataType::QASYMM8_SIGNED)),
613 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, -10) })),
Giorgio Arenae620a832020-02-17 16:33:20 +0000614 QuantizedActivationFunctionsDataset),
615 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Sheri Zhang681f2d42020-02-20 11:23:08 +0000616{
617 // Validate output
618 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
619}
Gunes Bayir38ce29d2021-08-04 12:45:33 +0100620FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit,
621 framework::dataset::make("DataType",
622 DataType::QASYMM8_SIGNED)),
623 framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.1f, -10) })),
624 QuantizedActivationFunctionsDataset),
625 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000626{
627 // Validate output
628 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
629}
Giorgio Arenae620a832020-02-17 16:33:20 +0000630FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit_9x9,
Sheri Zhang681f2d42020-02-20 11:23:08 +0000631 framework::dataset::make("DataType",
632 DataType::QASYMM8_SIGNED)),
633 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })),
Giorgio Arenae620a832020-02-17 16:33:20 +0000634 QuantizedActivationFunctionsDataset),
635 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Sheri Zhang681f2d42020-02-20 11:23:08 +0000636{
637 // Validate output
638 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
639}
640
641FIXTURE_DATA_TEST_CASE(RunCustomDataset, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arenae620a832020-02-17 16:33:20 +0000642 combine(combine(combine(combine(datasets::DirectConvolutionLayerDataset(),
643 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
644 framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) })),
645 QuantizedActivationFunctionsDataset),
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000646 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
Sheri Zhang681f2d42020-02-20 11:23:08 +0000647{
648 // Validate output
649 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
650}
651
652TEST_SUITE_END() // QASYMM8_SIGNED
Michalis Spyrou064add62018-11-01 18:14:27 +0000653TEST_SUITE_END() // Quantized
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000654TEST_SUITE_END() // NCHW
Michalis Spyrou064add62018-11-01 18:14:27 +0000655TEST_SUITE_END() // DirectConvolutionLayer
Gian Marco Iodice0841ca02021-02-01 14:37:02 +0000656TEST_SUITE_END() // CL
657
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100658} // namespace validation
659} // namespace test
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000660} // namespace arm_compute