blob: 1f5b781690d32e45893ea132347e6d3c0b533eea [file] [log] [blame]
Pablo Tello4a626a72018-04-04 10:01:14 +01001/*
Giorgio Arena4f8ce132021-01-07 16:35:05 +00002 * Copyright (c) 2018-2021 Arm Limited.
Pablo Tello4a626a72018-04-04 10:01:14 +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 */
Pablo Tello4a626a72018-04-04 10:01:14 +010024#include "arm_compute/core/Types.h"
Georgios Pinitas7891a732021-08-20 21:39:25 +010025#include "src/gpu/cl/kernels/ClIm2ColKernel.h"
Pablo Tello4a626a72018-04-04 10:01:14 +010026#include "tests/CL/CLAccessor.h"
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010027#include "tests/CL/Helper.h"
Pablo Tello4a626a72018-04-04 10:01:14 +010028#include "tests/framework/Asserts.h"
29#include "tests/framework/Macros.h"
30#include "tests/framework/datasets/Datasets.h"
31#include "tests/validation/Validation.h"
32#include "tests/validation/fixtures/Im2ColFixture.h"
33
34namespace arm_compute
35{
36namespace test
37{
38namespace validation
39{
Pablo Tello4a626a72018-04-04 10:01:14 +010040TEST_SUITE(CL)
41TEST_SUITE(Im2Col)
42
Manuel Bottinid844c082021-07-14 12:58:54 +010043using ClIm2Col = ClSynthetizeOperatorWithBorder<opencl::kernels::ClIm2ColKernel>;
Pablo Tello4a626a72018-04-04 10:01:14 +010044
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010045/** Negative tests
46 *
47 * A series of validation tests on configurations which according to the API specification
48 * the function should fail against.
49 *
50 * Checks performed in order:
51 * - Pass unsupported data type for input
52 * - Pass a quantized input and ask to compress the bias into the resulting matrix
53 * - Pass a dilation factor of 0
54 * - Check NHWC data layout while requesting to perform a grouped operation
55 * - Check NCHW grouped operation when the number of channels is not multiple of the groups
56 * - Pass an invalid output shape
57 */
58TEST_CASE(Negative, framework::DatasetMode::ALL)
Pablo Tello4a626a72018-04-04 10:01:14 +010059{
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010060 // Unsupported data type
61 {
62 const auto input = TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::SIZET);
63 const auto output = TensorInfo(TensorShape(9U, 10U, 12U, 2U), 1, DataType::F32);
64 const auto conv_size = Size2D(3, 3);
65 const bool has_bias = false;
Manuel Bottinid844c082021-07-14 12:58:54 +010066 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias);
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010067 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
68 }
Pablo Tello4a626a72018-04-04 10:01:14 +010069
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010070 // Passing quantized input and ask to merge the bias in the output
71 {
72 const auto input = TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::QASYMM8);
73 const auto output = TensorInfo(TensorShape(9U, 80U, 2U), 1, DataType::QASYMM8);
74 const auto conv_size = Size2D(3, 3);
75 const bool has_bias = true;
Manuel Bottinid844c082021-07-14 12:58:54 +010076 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias);
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010077 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
78 }
79
80 // Invalid dilation
81 {
82 const auto input = TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32);
83 const auto output = TensorInfo(TensorShape(9U, 80U, 2U), 1, DataType::F32);
84 const auto conv_size = Size2D(3, 3);
85 const auto dilation = Size2D(0, 1);
86 const bool has_bias = false;
Manuel Bottinid844c082021-07-14 12:58:54 +010087 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation);
Georgios Pinitasc1c366d2020-03-30 18:09:24 +010088 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
89 }
90
91 // NHWC and grouping greater than 1
92 {
93 const auto input = TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32, DataLayout::NHWC);
94 const auto output = TensorInfo(TensorShape(9U, 80U, 2U), 1, DataType::F32);
95 const auto conv_size = Size2D(3, 3);
96 const auto dilation = Size2D(1, 1);
97 const bool has_bias = false;
98 const unsigned int num_groups = 2;
Manuel Bottinid844c082021-07-14 12:58:54 +010099 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation, num_groups);
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100100 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
101 }
102
103 // NCWH and channels % num_groups !=0
104 {
105 const auto input = TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32, DataLayout::NCHW);
106 const auto output = TensorInfo(TensorShape(9U, 80U, 2U), 1, DataType::F32);
107 const auto conv_size = Size2D(3, 3);
108 const auto dilation = Size2D(1, 1);
109 const bool has_bias = false;
110 const unsigned int num_groups = 2;
Manuel Bottinid844c082021-07-14 12:58:54 +0100111 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation, num_groups);
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100112 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
113 }
114
115 // Invalid output shape
116 {
117 const auto input = TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32);
118 const auto output = TensorInfo(TensorShape(9U, 81U, 2U), 1, DataType::F32);
119 const auto conv_size = Size2D(3, 3);
120 const bool has_bias = false;
Manuel Bottinid844c082021-07-14 12:58:54 +0100121 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias);
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100122 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
123 }
SiCong Lif650ea52020-08-05 15:04:00 +0100124
125 // Kernel dimensions are too big
126 {
127 const auto input = TensorInfo(TensorShape(1U, 9U, 5U, 2U), 1, DataType::F32, DataLayout::NHWC);
128 const auto output = TensorInfo(TensorShape(1U, 1U, 1U, 2U), 1, DataType::F32, DataLayout::NHWC);
129 const auto conv_size = Size2D(9, 9);
130 const bool has_bias = false;
Manuel Bottinid844c082021-07-14 12:58:54 +0100131 const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias);
SiCong Lif650ea52020-08-05 15:04:00 +0100132 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
133 }
Pablo Tello4a626a72018-04-04 10:01:14 +0100134}
Pablo Tello4a626a72018-04-04 10:01:14 +0100135
136template <typename T>
Manuel Bottinid844c082021-07-14 12:58:54 +0100137using ClIm2ColFixture = Im2ColOpValidationFixture<CLTensor, CLAccessor, ClIm2Col, T, true>;
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100138
139TEST_SUITE(NHWC)
140
141/** Test special kernel used for NHWC for 3x3 kernels
142 *
143 * @note 2 elements processed per iteration
144 *
145 * Three tests will be run:
146 * - Channels are multiple of elements processed
147 * - Channels larger and non multiple of elements used
148 * - Channels smaller and not multiple of elements used
149 *
150 * Kernel tested im2col3x3_nhwc
151 */
152FIXTURE_DATA_TEST_CASE(W3x3,
Manuel Bottinid844c082021-07-14 12:58:54 +0100153 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100154 framework::DatasetMode::ALL,
155 combine(combine(combine(combine(combine(combine(
156 framework::dataset::make("InputShape",
157{
Giorgio Arena4f8ce132021-01-07 16:35:05 +0000158 TensorShape(5U, 7U, 2U, 2U), TensorShape(4U, 6U, 3U, 2U), TensorShape(5U, 3U, 1U, 2U),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100159}),
160framework::dataset::make("DataType", DataType::F32)),
161framework::dataset::make("Kernel", Size2D(3, 3))),
SiCong Lif650ea52020-08-05 15:04:00 +0100162framework::dataset::make("PadStride", { PadStrideInfo(1, 2, 1, 2), PadStrideInfo(1, 1, 0, 0) })),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100163framework::dataset::make("QInfo", QuantizationInfo())),
164framework::dataset::make("DataLayout", DataLayout::NHWC)),
165framework::dataset::make("Groups", 1)))
Pablo Tello4a626a72018-04-04 10:01:14 +0100166{
167 // Validate output
168 validate(CLAccessor(_target), _reference);
169}
Pablo Tello4a626a72018-04-04 10:01:14 +0100170
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100171/** Test special kernel used for NHWC for 9x9 kernels
172 *
173 * @note 2 elements processed per iteration
174 *
175 * Three tests will be run:
176 * - Channels are multiple of elements processed
177 * - Channels larger and non multiple of elements used
178 * - Channels smaller and not multiple of elements used
179 *
180 * Kernel tested im2col9x9_nhwc
181 */
182FIXTURE_DATA_TEST_CASE(W9x9,
Manuel Bottinid844c082021-07-14 12:58:54 +0100183 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100184 framework::DatasetMode::ALL,
185 combine(combine(combine(combine(combine(combine(
186 framework::dataset::make("InputShape",
187{
Giorgio Arena4f8ce132021-01-07 16:35:05 +0000188 TensorShape(13U, 15U, 2U, 2U), TensorShape(15U, 12U, 3U, 2U), TensorShape(13U, 22U, 1U, 2U),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100189}),
190framework::dataset::make("DataType", DataType::F32)),
191framework::dataset::make("Kernel", Size2D(9, 9))),
SiCong Lif650ea52020-08-05 15:04:00 +0100192framework::dataset::make("PadStride", { PadStrideInfo(2, 2, 1, 2), PadStrideInfo(1, 1, 0, 0) })),
193framework::dataset::make("QInfo", QuantizationInfo())),
194framework::dataset::make("DataLayout", DataLayout::NHWC)),
195framework::dataset::make("Groups", 1)))
196{
197 // Validate output
198 validate(CLAccessor(_target), _reference);
199}
200
201/** Test generic kernel used for NHWC
202 *
203 * @note 2 elements processed per iteration
204 *
205 * Three tests will be run:
206 * - Channels are multiple of elements processed
207 * - Channels larger and non multiple of elements used
208 * - Channels smaller and not multiple of elements used
209 *
210 * Kernel tested im2col_generic_nhwc
211 */
212FIXTURE_DATA_TEST_CASE(Generic,
Manuel Bottinid844c082021-07-14 12:58:54 +0100213 ClIm2ColFixture<float>,
SiCong Lif650ea52020-08-05 15:04:00 +0100214 framework::DatasetMode::ALL,
215 combine(combine(combine(combine(combine(combine(
216 framework::dataset::make("InputShape",
217{
Giorgio Arena4f8ce132021-01-07 16:35:05 +0000218 TensorShape(13U, 15U, 4U, 2U), TensorShape(15U, 12U, 7U, 1U), TensorShape(5U, 3U, 1U, 1U),
SiCong Lif650ea52020-08-05 15:04:00 +0100219}),
220framework::dataset::make("DataType", DataType::F32)),
221framework::dataset::make("Kernel", Size2D(5, 3))),
222framework::dataset::make("PadStride", { PadStrideInfo(2, 2, 1, 2), PadStrideInfo(1, 1, 0, 0) })),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100223framework::dataset::make("QInfo", QuantizationInfo())),
224framework::dataset::make("DataLayout", DataLayout::NHWC)),
225framework::dataset::make("Groups", 1)))
Pablo Tello4a626a72018-04-04 10:01:14 +0100226{
227 // Validate output
228 validate(CLAccessor(_target), _reference);
229}
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100230TEST_SUITE_END() // NHWC
Pablo Tello4a626a72018-04-04 10:01:14 +0100231
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100232TEST_SUITE(NCHW)
Pablo Tello4a626a72018-04-04 10:01:14 +0100233
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100234/** Test special kernel used for NCHW for 1x1 kernels with stride 1 and no padding
235 *
236 * @note 4 elements processed per iteration
237 *
238 * Three tests will be run:
239 * - Channels are multiple of elements processed
240 * - Channels larger and non multiple of elements used
241 * - Channels smaller and not multiple of elements used
242 *
243 * Kernel tested im2col1x1_stridex1_nchw
244 */
245FIXTURE_DATA_TEST_CASE(W1x1_Stride1_NoPad,
Manuel Bottinid844c082021-07-14 12:58:54 +0100246 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100247 framework::DatasetMode::ALL,
248 combine(combine(combine(combine(combine(combine(
249 framework::dataset::make("InputShape", { TensorShape(4U, 4U, 3U, 2U), TensorShape(5U, 4U, 3U, 2U), TensorShape(3U, 4U, 3U, 2U) }),
250 framework::dataset::make("DataType", DataType::F32)),
251 framework::dataset::make("Kernel", Size2D(1, 1))),
252 framework::dataset::make("PadStride", PadStrideInfo(1, 1, 0, 0))),
253 framework::dataset::make("QInfo", QuantizationInfo())),
254 framework::dataset::make("DataLayout", DataLayout::NCHW)),
255 framework::dataset::make("Groups", 1)))
Giorgio Arena0f170392018-07-18 16:13:12 +0100256{
257 // Validate output
258 validate(CLAccessor(_target), _reference);
259}
260
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100261/** Test special kernel used for NCHW for 3x3 kernels
262 *
263 * @note 1 elements processed per iteration
264 *
265 * Executed single test as padding is required.
266 *
267 * Kernel tested im2col3x3_nchw
268 */
269FIXTURE_DATA_TEST_CASE(W3x3,
Manuel Bottinid844c082021-07-14 12:58:54 +0100270 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100271 framework::DatasetMode::ALL,
272 combine(combine(combine(combine(combine(combine(
273 framework::dataset::make("InputShape", TensorShape(4U, 4U, 3U, 2U)),
274 framework::dataset::make("DataType", DataType::F32)),
275 framework::dataset::make("Kernel", Size2D(3, 3))),
276 framework::dataset::make("PadStride", PadStrideInfo(1, 2, 1, 2))),
277 framework::dataset::make("QInfo", QuantizationInfo())),
278 framework::dataset::make("DataLayout", DataLayout::NCHW)),
279 framework::dataset::make("Groups", { 1, 3 })))
Giorgio Arena0f170392018-07-18 16:13:12 +0100280{
281 // Validate output
282 validate(CLAccessor(_target), _reference);
283}
284
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100285/** Test special kernel used for NCHW for 5x5 kernels
286 *
287 * @note 1 elements processed per iteration
288 *
289 * Executed single test as padding is required.
290 *
291 * Kernel tested im2col5x5_nchw
292 */
293FIXTURE_DATA_TEST_CASE(W5x5,
Manuel Bottinid844c082021-07-14 12:58:54 +0100294 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100295 framework::DatasetMode::ALL,
296 combine(combine(combine(combine(combine(combine(
297 framework::dataset::make("InputShape", TensorShape(7U, 4U, 3U, 2U)),
298 framework::dataset::make("DataType", DataType::F32)),
299 framework::dataset::make("Kernel", Size2D(5, 5))),
300 framework::dataset::make("PadStride", PadStrideInfo(2, 1, 2, 1))),
301 framework::dataset::make("QInfo", QuantizationInfo())),
302 framework::dataset::make("DataLayout", DataLayout::NCHW)),
303 framework::dataset::make("Groups", { 1, 3 })))
Giorgio Arena0f170392018-07-18 16:13:12 +0100304{
305 // Validate output
306 validate(CLAccessor(_target), _reference);
307}
308
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100309/** Test special kernel used for NCHW for 11x11 kernels when no padding present
310 *
311 * @note 1 elements processed per iteration
312 *
313 * Two tests will be run:
314 * - Without padding requirements
315 * - With padding requirements
316 *
317 * Kernel tested im2col11x11_padx0_pady0_nchw
318 */
319FIXTURE_DATA_TEST_CASE(W11x11_NoPad,
Manuel Bottinid844c082021-07-14 12:58:54 +0100320 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100321 framework::DatasetMode::ALL,
322 combine(combine(combine(combine(combine(combine(
323 framework::dataset::make("InputShape", { TensorShape(11U, 11U, 2U, 2U), TensorShape(14U, 13U, 1U, 2U) }),
324 framework::dataset::make("DataType", DataType::F32)),
325 framework::dataset::make("Kernel", Size2D(11, 11))),
326 framework::dataset::make("PadStride", PadStrideInfo(1, 1, 0, 0))),
327 framework::dataset::make("QInfo", QuantizationInfo())),
328 framework::dataset::make("DataLayout", DataLayout::NCHW)),
329 framework::dataset::make("Groups", 1)))
Giorgio Arena0f170392018-07-18 16:13:12 +0100330{
331 // Validate output
332 validate(CLAccessor(_target), _reference);
333}
Giorgio Arena0f170392018-07-18 16:13:12 +0100334
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100335/** Test special kernel used for NCHW for kernels which do not fall in the categories above and have no padding present
336 *
337 * @note 1 elements processed per iteration
338 *
339 * Executed single test as padding is required.
340 *
341 * Kernel tested im2col_generic_padx0_pady0_nchw
342 */
343FIXTURE_DATA_TEST_CASE(GenericZeroPad,
Manuel Bottinid844c082021-07-14 12:58:54 +0100344 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100345 framework::DatasetMode::ALL,
346 combine(combine(combine(combine(combine(combine(
347 framework::dataset::make("InputShape", TensorShape(13U, 11U, 2U, 2U)),
348 framework::dataset::make("DataType", DataType::F32)),
349 framework::dataset::make("Kernel", Size2D(3, 2))),
350 framework::dataset::make("PadStride", PadStrideInfo(2, 1, 0, 0))),
351 framework::dataset::make("QInfo", QuantizationInfo())),
352 framework::dataset::make("DataLayout", DataLayout::NCHW)),
353 framework::dataset::make("Groups", { 1, 2 })))
354{
355 // Validate output
356 validate(CLAccessor(_target), _reference);
357}
358TEST_SUITE_END() // NCHW
359
360/** Generic NCHW/NHWC kernel
361 *
362 * @note 1 elements processed per iteration
363 *
364 * Padding is not needed thus executed sample tests with different kernels sizes
365 * and stride/padding information
366 *
367 * Kernel tested im2col_generic_(nchw|nhwc)
368 */
369FIXTURE_DATA_TEST_CASE(Generic,
Manuel Bottinid844c082021-07-14 12:58:54 +0100370 ClIm2ColFixture<float>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100371 framework::DatasetMode::ALL,
372 combine(combine(combine(combine(combine(combine(
SiCong Lif650ea52020-08-05 15:04:00 +0100373 framework::dataset::make("InputShape", TensorShape(13U, 11U, 5U, 2U)),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100374 framework::dataset::make("DataType", DataType::F32)),
375 framework::dataset::make("Kernel", { Size2D(3, 2), Size2D(3, 5) })),
376 framework::dataset::make("PadStride", PadStrideInfo(2, 1, 2, 1))),
377 framework::dataset::make("QInfo", QuantizationInfo())),
378 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
379 framework::dataset::make("Groups", 1)))
380{
381 // Validate output
382 validate(CLAccessor(_target), _reference);
383}
384
385/** Tests to check that quantized padding value is set correctly
386 *
387 * Kernels tested:
388 * - im2col_generic_nhwc
389 * - im2col_generic_nchw
390 * - im2col5x5_nchw
391 * - im2col3x3_nhwc
392 * - im2col3x3_nchw
393 * - im2col9x9_nhwc
394 */
395FIXTURE_DATA_TEST_CASE(Quantized,
Manuel Bottinid844c082021-07-14 12:58:54 +0100396 ClIm2ColFixture<uint8_t>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100397 framework::DatasetMode::ALL,
398 combine(combine(combine(combine(combine(combine(
SiCong Lif650ea52020-08-05 15:04:00 +0100399 framework::dataset::make("InputShape", TensorShape(13U, 11U, 11U, 2U)),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100400 framework::dataset::make("DataType", DataType::QASYMM8)),
401 framework::dataset::make("Kernel", { Size2D(1, 1), Size2D(3, 3), Size2D(5, 5), Size2D(3, 5), Size2D(9, 9) })),
402 framework::dataset::make("PadStride", { PadStrideInfo(1, 2, 1, 1) })),
403 framework::dataset::make("QInfo", QuantizationInfo(0.5f, 10))),
404 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
405 framework::dataset::make("Groups", 1)))
406{
407 // Validate output
408 validate(CLAccessor(_target), _reference);
409}
410
411/** Tests to check that half-precision execution
412 *
413 * Kernels tested:
414 * - im2col_generic_nhwc
415 * - im2col_generic_nchw
416 * - im2col5x5_nchw
417 * - im2col3x3_nhwc
418 * - im2col3x3_nchw
419 * - im2col9x9_nhwc
420 */
421FIXTURE_DATA_TEST_CASE(FP16,
Manuel Bottinid844c082021-07-14 12:58:54 +0100422 ClIm2ColFixture<half>,
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100423 framework::DatasetMode::ALL,
424 combine(combine(combine(combine(combine(combine(
SiCong Lif650ea52020-08-05 15:04:00 +0100425 framework::dataset::make("InputShape", TensorShape(13U, 11U, 11U, 2U)),
Georgios Pinitasc1c366d2020-03-30 18:09:24 +0100426 framework::dataset::make("DataType", DataType::F16)),
427 framework::dataset::make("Kernel", { Size2D(1, 1), Size2D(3, 3), Size2D(5, 5), Size2D(3, 5), Size2D(9, 9) })),
428 framework::dataset::make("PadStride", { PadStrideInfo(1, 2, 1, 1) })),
429 framework::dataset::make("QInfo", QuantizationInfo())),
430 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
431 framework::dataset::make("Groups", 1)))
432{
433 // Validate output
434 validate(CLAccessor(_target), _reference);
435}
436
437TEST_SUITE_END() // Im2Col
438TEST_SUITE_END() // CL
Pablo Tello4a626a72018-04-04 10:01:14 +0100439} // namespace validation
440} // namespace test
441} // namespace arm_compute