blob: 45047cab44c53e314f9189b7527fddae69866ffb [file] [log] [blame]
Gian Marco Iodice9285adb2019-09-05 16:10:27 +01001/*
Gian Marco Iodice211a55d2022-08-31 11:47:08 +01002 * Copyright (c) 2019-2022 Arm Limited.
Gian Marco Iodice9285adb2019-09-05 16:10:27 +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 */
Gian Marco Iodice9285adb2019-09-05 16:10:27 +010024#include "arm_compute/core/KernelDescriptors.h"
25#include "arm_compute/core/Types.h"
26#include "arm_compute/core/utils/misc/ShapeCalculator.h"
27#include "arm_compute/runtime/CL/CLTensor.h"
28#include "arm_compute/runtime/CL/CLTensorAllocator.h"
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +010029#include "src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.h"
Gian Marco Iodice9285adb2019-09-05 16:10:27 +010030#include "tests/CL/CLAccessor.h"
31#include "tests/CL/Helper.h"
32#include "tests/PaddingCalculator.h"
Gian Marco Iodice9285adb2019-09-05 16:10:27 +010033#include "tests/framework/Asserts.h"
34#include "tests/framework/Macros.h"
35#include "tests/framework/datasets/Datasets.h"
36#include "tests/validation/Validation.h"
37#include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h"
38
39namespace arm_compute
40{
41namespace test
42{
43namespace validation
44{
45using namespace arm_compute::misc::shape_calculator;
46
47// Create function for CLDepthwiseConvolutionLayerNativeKernel
48using CLDepthwiseConvolutionLayerNative = CLSynthetizeFunction<CLDepthwiseConvolutionLayerNativeKernel>;
49
50// Fixture for CLDepthwiseConvolutionLayerNative
51template <typename T>
52using CLDepthwiseConvolutionLayerNativeFixture = DepthwiseConvolutionLayerNativeConfigurableValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayerNative, T>;
53
54namespace
55{
56// *INDENT-OFF*
57// clang-format off
58RelativeTolerance<float> rel_tolerance_f32(0.001f);
59constexpr float abs_tolerance_f32(0.0001f);
60
Giorgio Arenadac622a2019-12-23 15:01:17 +000061RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.01f));
Michele Di Giorgio7d7c4202020-02-25 20:13:36 +000062constexpr float abs_tolerance_f16(0.03f);
Gian Marco Iodice9285adb2019-09-05 16:10:27 +010063
64/** Width values to test - Precommit */
Gian Marco Iodice8155c022021-04-16 15:08:59 +010065const auto width_values_precommit = framework::dataset::make("width", { 1U, 33U } );
Gian Marco Iodice9285adb2019-09-05 16:10:27 +010066
67/** Width values to test - Nightly */
68const auto width_values_nightly = framework::dataset::make("width", { 53U, 47U } );
69
70/** Height values to test - Precommit */
71const auto height_values_precommit = framework::dataset::make("height", { 19U } );
72
73/** Height values to test - Nightly */
74const auto height_values_nightly = framework::dataset::make("height", { 39U, 43U } );
75
76/** Channel values to test - Precommit */
77const auto channel_values_precommit = framework::dataset::make("channels", { 15U });
78
79/** Channel values to test - Nightly */
80const auto channel_values_nightly = framework::dataset::make("channels", { 33U, 19U });
81
Gian Marco Iodice8155c022021-04-16 15:08:59 +010082/** Channel values to test with cl_image support - Precommit */
83const auto channel_values_export_to_cl_image_precommit = framework::dataset::make("channels", { 16U });
84
85/** Channel values to test with cl_image support - Nightly */
86const auto channel_values_export_to_cl_image_nightly = framework::dataset::make("channels", { 32U });
87
Gian Marco Iodice9285adb2019-09-05 16:10:27 +010088/** Batch values to test - Precommit */
89const auto batch_values_precommit = framework::dataset::make("batch", { 1U, 2U });
90
91/** Batch values to test - Nightly */
92const auto batch_values_nightly = framework::dataset::make("batch", { 1U, 3U });
93
94/** Kernel size values to test - Precommit */
95const auto kernel_sz_values_precommit = framework::dataset::make("kernel_size", { Size2D(1U, 1U), Size2D(1U, 3U), Size2D(5U, 5U) });
96
97/** Kernel size values to test - Nightly */
98const auto kernel_sz_values_nightly = framework::dataset::make("kernel_size", { Size2D(3U, 5U), Size2D(5U, 1U), Size2D(1U, 7U), Size2D(9U, 7U) });
99
100/** Depth multiplier values to test - All */
101const auto depth_multiplier_values = framework::dataset::make("depth_multiplier", {3U});
102
103/** Dilation values to test - All */
104const auto dilation_values = framework::dataset::make("dilation", { Size2D(1U, 1U), Size2D(3U, 3U) });
105
106/** Stride values to test - All */
107const auto stride_values = framework::dataset::make("stride", { Size2D(1U, 1U), Size2D(3U, 2U) });
108
109/** Padding values to test - All */
110const auto padding_valid_values = framework::dataset::make("padding_valid", { true, false });
111
112/** Data type values to test - All */
113const auto data_type_values = framework::dataset::make("data_type", { DataType::F32, DataType::F16 });
114
115/** Data layout values to test - All */
116const auto data_layout_values = framework::dataset::make("data_layout", { DataLayout::NHWC });
117
118/** N0 values to test - Precommit */
119const auto n0_values_precommit = framework::dataset::make("N0", {2, 4});
120
121/** N0 values to test - Nightly */
122const auto n0_values_nightly = framework::dataset::make("N0", {3, 8});
123
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100124/** N0 values to test with cl_image support - Precommit */
125const auto n0_values_export_to_cl_image_precommit = framework::dataset::make("N0", {4});
126
127/** N0 values to test with cl_image support - Nightly */
128const auto n0_values_export_to_cl_image_nightly = framework::dataset::make("N0", {8});
129
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100130/** Activation values to test */
131const auto act_values = framework::dataset::make("Activation",
132{
133 ActivationLayerInfo(),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100134 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.0f, 0.5f),
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100135});
136
137} // namespace
138
139TEST_SUITE(CL)
140TEST_SUITE(DepthwiseConvolutionLayerNative)
141TEST_SUITE(Float)
142TEST_SUITE(FP32)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000143FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100144 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100145 width_values_precommit,
146 height_values_precommit),
147 channel_values_precommit),
148 batch_values_precommit),
149 kernel_sz_values_precommit),
150 framework::dataset::make("depth_multiplier", 1)),
151 dilation_values),
152 stride_values),
153 padding_valid_values),
154 framework::dataset::make("DataType", DataType::F32)),
155 data_layout_values),
156 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100157 n0_values_precommit),
158 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100159{
160 // Validate output
161 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
162}
163
Giorgio Arena68e29da2021-02-08 16:31:10 +0000164FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100165 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100166 width_values_nightly,
167 height_values_nightly),
168 channel_values_nightly),
169 batch_values_nightly),
170 kernel_sz_values_nightly),
171 framework::dataset::make("depth_multiplier", 1)),
172 dilation_values),
173 stride_values),
174 padding_valid_values),
175 framework::dataset::make("DataType", DataType::F32)),
176 data_layout_values),
177 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100178 n0_values_nightly),
179 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100180{
181 // Validate output
182 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
183}
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100184
185TEST_SUITE(ExportWeightsToCLImage)
186FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL,
187 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
188 width_values_precommit,
189 height_values_precommit),
190 channel_values_export_to_cl_image_precommit),
191 batch_values_precommit),
192 kernel_sz_values_precommit),
193 framework::dataset::make("depth_multiplier", 1)),
194 dilation_values),
195 stride_values),
196 padding_valid_values),
197 framework::dataset::make("DataType", DataType::F32)),
198 data_layout_values),
199 act_values),
200 n0_values_export_to_cl_image_precommit),
201 framework::dataset::make("ExportToCLImage", true)))
202{
203 // Validate output
204 if(_validate_output)
205 {
206 // Validate output
207 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
208 }
209 else
210 {
211 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
212 framework::ARM_COMPUTE_PRINT_INFO();
213 }
214}
215
216FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::NIGHTLY,
217 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
218 width_values_nightly,
219 height_values_nightly),
220 channel_values_export_to_cl_image_nightly),
221 batch_values_nightly),
222 kernel_sz_values_nightly),
223 framework::dataset::make("depth_multiplier", 1)),
224 dilation_values),
225 stride_values),
226 padding_valid_values),
227 framework::dataset::make("DataType", DataType::F32)),
228 data_layout_values),
229 act_values),
230 n0_values_export_to_cl_image_nightly),
231 framework::dataset::make("ExportToCLImage", true)))
232{
233 // Validate output
234 if(_validate_output)
235 {
236 // Validate output
237 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
238 }
239 else
240 {
241 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
242 framework::ARM_COMPUTE_PRINT_INFO();
243 }
244}
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100245
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100246TEST_SUITE_END() // ExportWeightsToCLImage
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100247TEST_SUITE_END() // FP32
248
249TEST_SUITE(FP16)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000250FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100251 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100252 width_values_precommit,
253 height_values_precommit),
254 channel_values_precommit),
255 batch_values_precommit),
256 kernel_sz_values_precommit),
257 framework::dataset::make("depth_multiplier", 1)),
258 dilation_values),
259 stride_values),
260 padding_valid_values),
261 framework::dataset::make("DataType", DataType::F16)),
262 data_layout_values),
263 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100264 n0_values_precommit),
265 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100266{
267 // Validate output
Giorgio Arenadac622a2019-12-23 15:01:17 +0000268 validate(CLAccessor(_target), _reference, rel_tolerance_f16);
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100269}
270
Giorgio Arena68e29da2021-02-08 16:31:10 +0000271FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100272 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100273 width_values_nightly,
274 height_values_nightly),
275 channel_values_nightly),
276 batch_values_nightly),
277 kernel_sz_values_nightly),
278 framework::dataset::make("depth_multiplier", 1)),
279 dilation_values),
280 stride_values),
281 padding_valid_values),
282 framework::dataset::make("DataType", DataType::F16)),
283 data_layout_values),
284 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100285 n0_values_nightly),
286 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100287{
288 // Validate output
Giorgio Arenadac622a2019-12-23 15:01:17 +0000289 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100290}
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100291
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100292TEST_SUITE(ExportWeightsToCLImage)
293FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL,
294 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
295 width_values_precommit,
296 height_values_precommit),
297 channel_values_export_to_cl_image_precommit),
298 batch_values_precommit),
299 kernel_sz_values_precommit),
300 framework::dataset::make("depth_multiplier", 1)),
301 dilation_values),
302 stride_values),
303 padding_valid_values),
304 framework::dataset::make("DataType", DataType::F16)),
305 data_layout_values),
306 act_values),
307 n0_values_export_to_cl_image_precommit),
308 framework::dataset::make("ExportToCLImage", true)))
309{
310 // Validate output
311 if(_validate_output)
312 {
313 // Validate output
314 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
315 }
316 else
317 {
318 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
319 framework::ARM_COMPUTE_PRINT_INFO();
320 }
321}
322
323FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::NIGHTLY,
324 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
325 width_values_nightly,
326 height_values_nightly),
327 channel_values_export_to_cl_image_nightly),
328 batch_values_nightly),
329 kernel_sz_values_nightly),
330 framework::dataset::make("depth_multiplier", 1)),
331 dilation_values),
332 stride_values),
333 padding_valid_values),
334 framework::dataset::make("DataType", DataType::F16)),
335 data_layout_values),
336 act_values),
337 n0_values_export_to_cl_image_nightly),
338 framework::dataset::make("ExportToCLImage", true)))
339{
340 // Validate output
341 if(_validate_output)
342 {
343 // Validate output
344 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
345 }
346 else
347 {
348 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
349 framework::ARM_COMPUTE_PRINT_INFO();
350 }
351}
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100352
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100353TEST_SUITE_END() // ExportWeightsToCLImage
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100354TEST_SUITE_END() // FP16
355TEST_SUITE_END() // Float
356TEST_SUITE(DepthMultiplier)
357TEST_SUITE(Float)
358TEST_SUITE(FP32)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000359FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100360 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100361 framework::dataset::make("width", { 33U } ),
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100362 height_values_precommit),
363 channel_values_precommit),
364 batch_values_precommit),
365 kernel_sz_values_precommit),
366 depth_multiplier_values),
367 dilation_values),
368 stride_values),
369 padding_valid_values),
370 framework::dataset::make("DataType", DataType::F32)),
371 data_layout_values),
372 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100373 framework::dataset::make("N0", 1)),
374 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100375{
376 // Validate output
377 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
378}
379
Giorgio Arena68e29da2021-02-08 16:31:10 +0000380FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100381 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100382 framework::dataset::make("width", { 53U } ),
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100383 height_values_nightly),
384 channel_values_nightly),
385 batch_values_nightly),
386 kernel_sz_values_nightly),
387 depth_multiplier_values),
388 dilation_values),
389 stride_values),
390 padding_valid_values),
391 framework::dataset::make("DataType", DataType::F32)),
392 data_layout_values),
393 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100394 framework::dataset::make("N0", 1)),
395 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100396{
397 // Validate output
398 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
399}
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100400
401TEST_SUITE(DepthMultiplierMultipleOfOutputChannels)
402FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL,
403 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
404 framework::dataset::make("width", { 33U } ),
405 height_values_precommit),
406 channel_values_precommit),
407 batch_values_precommit),
408 kernel_sz_values_precommit),
409 framework::dataset::make("depth_multiplier", 2)),
410 dilation_values),
411 stride_values),
412 padding_valid_values),
413 framework::dataset::make("DataType", DataType::F32)),
414 data_layout_values),
415 act_values),
416 framework::dataset::make("N0", {2})),
417 framework::dataset::make("ExportToCLImage", false)))
418{
419 // Validate output
420 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
421}
422
423TEST_SUITE(ExportWeightsToCLImage)
424FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL,
425 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
426 framework::dataset::make("width", { 33U } ),
427 height_values_precommit),
428 channel_values_precommit),
429 batch_values_precommit),
430 kernel_sz_values_precommit),
431 framework::dataset::make("depth_multiplier", 4)),
432 dilation_values),
433 stride_values),
434 padding_valid_values),
435 framework::dataset::make("DataType", DataType::F32)),
436 data_layout_values),
437 act_values),
438 framework::dataset::make("N0", {4})),
439 framework::dataset::make("ExportToCLImage", true)))
440{
441 // Validate output
442 if(_validate_output)
443 {
444 // Validate output
445 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
446 }
447 else
448 {
449 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
450 framework::ARM_COMPUTE_PRINT_INFO();
451 }
452}
453TEST_SUITE_END() // ExportWeightsToCLImage
454TEST_SUITE_END() // DepthMultiplierMultipleOfOutputChannels
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100455TEST_SUITE_END() // FP32
456
457TEST_SUITE(FP16)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000458FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100459 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100460 framework::dataset::make("width", { 33U } ),
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100461 height_values_precommit),
462 channel_values_precommit),
463 batch_values_precommit),
464 kernel_sz_values_precommit),
465 depth_multiplier_values),
466 dilation_values),
467 stride_values),
468 padding_valid_values),
469 framework::dataset::make("DataType", DataType::F16)),
470 data_layout_values),
471 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100472 framework::dataset::make("N0", 1)),
473 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100474{
475 // Validate output
Giorgio Arenadac622a2019-12-23 15:01:17 +0000476 validate(CLAccessor(_target), _reference, rel_tolerance_f16);
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100477}
478
Giorgio Arena68e29da2021-02-08 16:31:10 +0000479FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100480 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100481 framework::dataset::make("width", { 53U } ),
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100482 height_values_nightly),
483 channel_values_nightly),
484 batch_values_nightly),
485 kernel_sz_values_nightly),
486 depth_multiplier_values),
487 dilation_values),
488 stride_values),
489 padding_valid_values),
490 framework::dataset::make("DataType", DataType::F16)),
491 data_layout_values),
492 act_values),
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100493 framework::dataset::make("N0", 1)),
494 framework::dataset::make("ExportToCLImage", false)))
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100495{
496 // Validate output
Giorgio Arenadac622a2019-12-23 15:01:17 +0000497 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100498}
Gian Marco Iodice211a55d2022-08-31 11:47:08 +0100499
500TEST_SUITE(DepthMultiplierMultipleOfOutputChannels)
501FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL,
502 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
503 framework::dataset::make("width", { 33U } ),
504 height_values_precommit),
505 channel_values_precommit),
506 batch_values_precommit),
507 kernel_sz_values_precommit),
508 framework::dataset::make("depth_multiplier", 2)),
509 dilation_values),
510 stride_values),
511 padding_valid_values),
512 framework::dataset::make("DataType", DataType::F16)),
513 data_layout_values),
514 act_values),
515 framework::dataset::make("N0", {2})),
516 framework::dataset::make("ExportToCLImage", false)))
517{
518 // Validate output
519 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
520}
521
522TEST_SUITE(ExportWeightsToCLImage)
523FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL,
524 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
525 framework::dataset::make("width", { 33U } ),
526 height_values_precommit),
527 channel_values_precommit),
528 batch_values_precommit),
529 kernel_sz_values_precommit),
530 framework::dataset::make("depth_multiplier", 4)),
531 dilation_values),
532 stride_values),
533 padding_valid_values),
534 framework::dataset::make("DataType", DataType::F16)),
535 data_layout_values),
536 act_values),
537 framework::dataset::make("N0", {4})),
538 framework::dataset::make("ExportToCLImage", true)))
539{
540 // Validate output
541 if(_validate_output)
542 {
543 // Validate output
544 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
545 }
546 else
547 {
548 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
549 framework::ARM_COMPUTE_PRINT_INFO();
550 }
551}
552TEST_SUITE_END() // ExportWeightsToCLImage
553TEST_SUITE_END() // DepthMultiplierMultipleOfOutputChannels
Gian Marco Iodice9285adb2019-09-05 16:10:27 +0100554TEST_SUITE_END() // FP16
555TEST_SUITE_END() // Float
556TEST_SUITE_END() // DepthMultiplier
557TEST_SUITE_END() // DepthwiseConvolutionLayerNative
558TEST_SUITE_END() // CL
559} // namespace validation
560} // namespace test
561} // namespace arm_compute