blob: ccb0abcbd110fe3415abf2f269e4b6f6b7a3117f [file] [log] [blame]
Sanghoon Leec8a85ba2017-11-29 11:23:14 +00001/*
Sanghoon Leed7ba5392017-12-13 11:28:50 +00002 * Copyright (c) 2017, 2018 ARM Limited.
Sanghoon Leec8a85ba2017-11-29 11:23:14 +00003 *
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/functions/CLConvolution.h"
26#include "arm_compute/runtime/Tensor.h"
27#include "arm_compute/runtime/TensorAllocator.h"
28#include "tests/CL/CLAccessor.h"
29#include "tests/PaddingCalculator.h"
30#include "tests/datasets/BorderModeDataset.h"
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/ConvolutionFixture.h"
37
38namespace arm_compute
39{
40namespace test
41{
42namespace validation
43{
44namespace
45{
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000046} // namespace
47
48TEST_SUITE(CL)
49TEST_SUITE(CustomConvolution)
Sanghoon Leed7ba5392017-12-13 11:28:50 +000050TEST_SUITE(CustomConvolutionSquare)
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000051TEST_SUITE(CustomConvolution3x3)
52
Sanghoon Leed7ba5392017-12-13 11:28:50 +000053DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)),
54 datasets::BorderModes()),
55 framework::dataset::make("filter_size", { 3 })),
56 shape, data_type, border_mode, filter_size)
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000057{
58 // Create tensors
59 CLTensor src = create_tensor<CLTensor>(shape, data_type);
60 CLTensor dst = create_tensor<CLTensor>(shape, data_type);
61
62 // Create conv matrix
63 int16_t conv[9];
64
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000065 ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
66 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
67
68 // Create and configure function
69 CLConvolution3x3 convolution;
Sanghoon Leed7ba5392017-12-13 11:28:50 +000070 convolution.configure(&src, &dst, conv, 0, border_mode);
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000071
72 // Validate valid region
Sanghoon Leed7ba5392017-12-13 11:28:50 +000073 const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000074 validate(dst.info()->valid_region(), dst_valid_region);
75
76 // Validate padding
77 PaddingCalculator calculator(shape.x(), 8);
78 calculator.set_border_size(1);
79 calculator.set_border_mode(border_mode);
80
81 const PaddingSize dst_padding = calculator.required_padding();
82
83 calculator.set_accessed_elements(16);
84 calculator.set_access_offset(-1);
85
86 const PaddingSize src_padding = calculator.required_padding();
87
88 validate(src.info()->padding(), src_padding);
89 validate(dst.info()->padding(), dst_padding);
90}
91
92template <typename T>
Sanghoon Leed7ba5392017-12-13 11:28:50 +000093using CLConvolutionFixture = ConvolutionSquareValidationFixture<CLTensor, CLAccessor, CLConvolution3x3, T>;
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000094
Sanghoon Leed7ba5392017-12-13 11:28:50 +000095FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000096 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +000097 datasets::BorderModes()),
98 framework::dataset::make("filter_size", { 3 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +000099{
100 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000101 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000102}
103
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000104FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000105 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000106 datasets::BorderModes()),
107 framework::dataset::make("filter_size", { 3 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000108{
109 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000110 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000111}
112TEST_SUITE_END() /* Custom_Convolution 3x3 */
113
114TEST_SUITE(CustomConvolution5x5)
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000115
116DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)),
117 datasets::BorderModes()),
118 framework::dataset::make("filter_size", { 5 })),
119 shape, data_type, border_mode, filter_size)
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000120{
121 // Create tensors
122 CLTensor src = create_tensor<CLTensor>(shape, data_type);
123 CLTensor dst = create_tensor<CLTensor>(shape, data_type);
124
125 // Create conv matrix
126 int16_t conv[25];
127
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000128 ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
129 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
130
131 // Create and configure function
132 CLConvolution5x5 convolution;
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000133 convolution.configure(&src, &dst, conv, 0, border_mode);
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000134
135 // Validate valid region
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000136 const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000137 validate(dst.info()->valid_region(), dst_valid_region);
138
139 // Validate padding
140 PaddingCalculator calculator(shape.x(), 8);
141 calculator.set_border_size(2);
142 calculator.set_border_mode(border_mode);
143
144 const PaddingSize dst_padding = calculator.required_padding();
145
146 calculator.set_accessed_elements(16);
147 calculator.set_access_offset(-2);
148
149 const PaddingSize src_padding = calculator.required_padding();
150
151 validate(src.info()->padding(), src_padding);
152 validate(dst.info()->padding(), dst_padding);
153}
154
155template <typename T>
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000156using CLConvolutionFixture = ConvolutionSquareValidationFixture<CLTensor, CLAccessor, CLConvolution5x5, T>;
157FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000158 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000159 datasets::BorderModes()),
160 framework::dataset::make("filter_size", { 5 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000161{
162 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000163 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000164}
165
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000166FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000167 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000168 datasets::BorderModes()),
169 framework::dataset::make("filter_size", { 5 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000170{
171 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000172 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000173}
174TEST_SUITE_END() /* Custom Convolution 5x5 */
175
176TEST_SUITE(CustomConvolution7x7)
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000177DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)),
178 datasets::BorderModes()),
179 framework::dataset::make("filter_size", { 7 })),
180 shape, data_type, border_mode, filter_size)
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000181{
182 // Create tensors
183 CLTensor src = create_tensor<CLTensor>(shape, data_type);
184 CLTensor dst = create_tensor<CLTensor>(shape, data_type);
185
186 // Create conv matrix
187 int16_t conv[49];
188
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000189 ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
190 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
191
192 // Create and configure function
193 CLConvolution7x7 convolution;
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000194 convolution.configure(&src, &dst, conv, 0, border_mode);
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000195
196 // Validate valid region
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000197 const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000198 validate(dst.info()->valid_region(), dst_valid_region);
199
200 // Validate padding
201 PaddingCalculator calculator(shape.x(), 8);
202 calculator.set_border_size(3);
203 calculator.set_border_mode(border_mode);
204
205 const PaddingSize dst_padding = calculator.required_padding();
206
207 calculator.set_accessed_elements(16);
208 calculator.set_access_offset(-3);
209
210 const PaddingSize src_padding = calculator.required_padding();
211
212 validate(src.info()->padding(), src_padding);
213 validate(dst.info()->padding(), dst_padding);
214}
215
216template <typename T>
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000217using CLConvolutionFixture = ConvolutionSquareValidationFixture<CLTensor, CLAccessor, CLConvolution7x7, T>;
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000218
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000219FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000220 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000221 datasets::BorderModes()),
222 framework::dataset::make("filter_size", { 7 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000223{
224 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000225 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000226}
227
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000228FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000229 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000230 datasets::BorderModes()),
231 framework::dataset::make("filter_size", { 7 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000232{
233 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000234 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000235}
236TEST_SUITE_END() /* Custom Convolution 7x7 */
237
238TEST_SUITE(CustomConvolution9x9)
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000239DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)),
240 datasets::BorderModes()),
241 framework::dataset::make("filter_size", { 9 })),
242 shape, data_type, border_mode, filter_size)
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000243{
244 // Create tensors
245 CLTensor src = create_tensor<CLTensor>(shape, data_type);
246 CLTensor dst = create_tensor<CLTensor>(shape, data_type);
247
248 // Create conv matrix
249 int16_t conv[81];
250
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000251 ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
252 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
253
254 // Create and configure function
255 CLConvolution9x9 convolution;
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000256 convolution.configure(&src, &dst, conv, 0, border_mode);
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000257
258 // Validate valid region
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000259 const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000260 validate(dst.info()->valid_region(), dst_valid_region);
261
262 // Validate padding
263 PaddingCalculator calculator(shape.x(), 8);
264 calculator.set_border_size(4);
265 calculator.set_border_mode(border_mode);
266
267 const PaddingSize dst_padding = calculator.required_padding();
268
269 calculator.set_accessed_elements(16);
270 calculator.set_access_offset(-4);
271
272 const PaddingSize src_padding = calculator.required_padding();
273
274 validate(src.info()->padding(), src_padding);
275 validate(dst.info()->padding(), dst_padding);
276}
277
278template <typename T>
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000279using CLConvolutionFixture = ConvolutionSquareValidationFixture<CLTensor, CLAccessor, CLConvolution9x9, T>;
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000280
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000281FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000282 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000283 datasets::BorderModes()),
284 framework::dataset::make("filter_size", { 9 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000285{
286 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000287 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000288}
289
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000290FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000291 DataType::U8)),
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000292 datasets::BorderModes()),
293 framework::dataset::make("filter_size", { 9 })))
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000294{
295 // Validate output
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000296 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000297}
298TEST_SUITE_END() /* Custom Convolution 9x9 */
Sanghoon Leed7ba5392017-12-13 11:28:50 +0000299TEST_SUITE_END() /* Custom Convolution Square */
300
301TEST_SUITE(CustomConvolutionRectangle)
302
303DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",
304 DataType::U8)),
305 datasets::BorderModes()),
306 framework::dataset::make("filter_width", { 3, 5, 7, 9 })),
307 framework::dataset::make("filter_height", { 3, 5, 7, 9 })),
308 shape, data_type, border_mode, filter_width, filter_height)
309{
310 // Create tensors
311 CLTensor src = create_tensor<CLTensor>(shape, data_type);
312 CLTensor dst = create_tensor<CLTensor>(shape, data_type);
313
314 // Create conv matrix
315 int16_t conv[filter_width * filter_height];
316
317 ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
318 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
319
320 // Create and configure function
321 CLConvolutionRectangle convolution;
322 convolution.configure(&src, &dst, conv, filter_width, filter_height, 1, border_mode);
323
324 // Validate valid region
325 const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_height / 2, filter_width / 2));
326 validate(dst.info()->valid_region(), dst_valid_region);
327
328 // Validate padding
329 PaddingCalculator calculator(shape.x(), 8);
330 calculator.set_border_size(filter_width / 2);
331 calculator.set_border_mode(border_mode);
332
333 const PaddingSize dst_padding = calculator.required_padding();
334
335 calculator.set_accessed_elements(16);
336 calculator.set_access_offset(-(filter_width / 2));
337
338 const PaddingSize width_padding = calculator.required_padding();
339
340 calculator.set_border_size(filter_height / 2);
341 calculator.set_access_offset(-(filter_height / 2));
342 const PaddingSize height_padding = calculator.required_padding();
343
344 validate(src.info()->padding(), width_padding, height_padding);
345 validate(dst.info()->padding(), dst_padding);
346}
347
348template <typename T>
349using CLConvolutionFixture = ConvolutionRectangleValidationFixture<CLTensor, CLAccessor, CLConvolutionRectangle, T>;
350
351FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
352 DataType::U8)),
353 datasets::BorderModes()),
354 framework::dataset::make("filter_width", { 3, 5, 7, 9 })),
355 framework::dataset::make("filter_height", { 3, 5, 7, 9 })))
356{
357 // Validate output
358 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
359}
360
361FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
362 DataType::U8)),
363 datasets::BorderModes()),
364 framework::dataset::make("filter_width", { 3, 5, 7, 9 })),
365 framework::dataset::make("filter_height", { 3, 5, 7, 9 })))
366{
367 // Validate output
368 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
369}
370TEST_SUITE_END() /* Custom Convolution Rectangle */
Sanghoon Lee571b18a2017-12-22 16:20:11 +0000371
372TEST_SUITE(CustomConvolutionSeparable)
373TEST_SUITE(CustomConvolutionSeparable5x5)
374template <typename T>
375using CLConvolutionFixture = ConvolutionSeparableValidationFixture<CLTensor, CLAccessor, CLConvolution5x5, T>;
376
377FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
378 DataType::U8)),
379 datasets::BorderModes()),
380 framework::dataset::make("filter_size", { 5 })))
381{
382 // Validate output
383 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
384}
385
386FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
387 DataType::U8)),
388 datasets::BorderModes()),
389 framework::dataset::make("filter_size", { 5 })))
390{
391 // Validate output
392 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
393}
394TEST_SUITE_END() /* Custom Convolution Separable 5x5 */
395
396TEST_SUITE(CustomConvolutionSeparablex7x7)
397template <typename T>
398using CLConvolutionFixture = ConvolutionSeparableValidationFixture<CLTensor, CLAccessor, CLConvolution7x7, T>;
399
400FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
401 DataType::U8)),
402 datasets::BorderModes()),
403 framework::dataset::make("filter_size", { 7 })))
404{
405 // Validate output
406 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
407}
408
409FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
410 DataType::U8)),
411 datasets::BorderModes()),
412 framework::dataset::make("filter_size", { 7 })))
413{
414 // Validate output
415 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
416}
417TEST_SUITE_END() /* Custom Convolution Separable 7x7 */
418
419TEST_SUITE(CustomConvolutionSeparable9x9)
420template <typename T>
421using CLConvolutionFixture = ConvolutionSeparableValidationFixture<CLTensor, CLAccessor, CLConvolution9x9, T>;
422
423FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
424 DataType::U8)),
425 datasets::BorderModes()),
426 framework::dataset::make("filter_size", { 9 })))
427{
428 // Validate output
429 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
430}
431
432FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
433 DataType::U8)),
434 datasets::BorderModes()),
435 framework::dataset::make("filter_size", { 9 })))
436{
437 // Validate output
438 validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)));
439}
440TEST_SUITE_END() /* Custom Convolution Separable 9x9 */
441
442TEST_SUITE_END() /* Custom Convolution Separable */
443TEST_SUITE_END() /* Custom Convolution */
Sanghoon Leec8a85ba2017-11-29 11:23:14 +0000444TEST_SUITE_END()
445} // namespace validation
446} // namespace test
447} // namespace arm_compute