blob: a5f0863746f900d8b19c6ba01fa469ab9a2f3703 [file] [log] [blame]
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +01001/*
Michalis Spyroud466c2d2018-01-30 10:54:39 +00002 * Copyright (c) 2017-2018 ARM Limited.
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +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#ifndef __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__
25#define __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__
26
27#include "arm_compute/core/TensorShape.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010028#include "tests/framework/datasets/Datasets.h"
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010029
30#include <type_traits>
31
32namespace arm_compute
33{
34namespace test
35{
36namespace datasets
37{
Gian Marco5420b282017-11-29 10:41:38 +000038/** Parent type for all for shape datasets. */
39using ShapeDataset = framework::dataset::ContainerDataset<std::vector<TensorShape>>;
40
41/** Data set containing small 1D tensor shapes. */
42class Small1DShapes final : public ShapeDataset
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010043{
44public:
Gian Marco5420b282017-11-29 10:41:38 +000045 Small1DShapes()
46 : ShapeDataset("Shape",
47 {
48 TensorShape{ 256U }
49 })
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010050 {
51 }
52};
53
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +000054/** Data set containing tiny 2D tensor shapes. */
55class Tiny2DShapes final : public ShapeDataset
56{
57public:
58 Tiny2DShapes()
59 : ShapeDataset("Shape",
60 {
61 TensorShape{ 7U, 7U },
62 TensorShape{ 11U, 13U },
63 })
64 {
65 }
66};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010067/** Data set containing small 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010068class Small2DShapes final : public ShapeDataset
69{
70public:
71 Small2DShapes()
72 : ShapeDataset("Shape",
73 {
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010074 TensorShape{ 7U, 7U },
75 TensorShape{ 27U, 13U },
76 TensorShape{ 128U, 64U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010077 })
78 {
79 }
80};
81
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +000082/** Data set containing tiny 3D tensor shapes. */
83class Tiny3DShapes final : public ShapeDataset
84{
85public:
86 Tiny3DShapes()
87 : ShapeDataset("Shape",
88 {
89 TensorShape{ 7U, 7U, 5U },
90 TensorShape{ 23U, 13U, 9U },
91 })
92 {
93 }
94};
95
Gian Marco Iodice06b184a2017-08-29 16:05:25 +010096/** Data set containing small 3D tensor shapes. */
97class Small3DShapes final : public ShapeDataset
98{
99public:
100 Small3DShapes()
101 : ShapeDataset("Shape",
102 {
103 TensorShape{ 7U, 7U, 5U },
104 TensorShape{ 27U, 13U, 37U },
105 TensorShape{ 128U, 64U, 21U }
106 })
107 {
108 }
109};
110
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000111/** Data set containing tiny 4D tensor shapes. */
112class Tiny4DShapes final : public ShapeDataset
113{
114public:
115 Tiny4DShapes()
116 : ShapeDataset("Shape",
117 {
118 TensorShape{ 7U, 7U, 5U, 3U },
119 TensorShape{ 17U, 13U, 7U, 2U },
120 })
121 {
122 }
123};
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100124/** Data set containing small 4D tensor shapes. */
125class Small4DShapes final : public ShapeDataset
126{
127public:
128 Small4DShapes()
129 : ShapeDataset("Shape",
130 {
131 TensorShape{ 7U, 7U, 5U, 3U },
132 TensorShape{ 27U, 13U, 37U, 2U },
133 TensorShape{ 128U, 64U, 21U, 3U }
134 })
135 {
136 }
137};
138
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100139/** Data set containing small tensor shapes. */
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000140class TinyShapes final : public ShapeDataset
141{
142public:
143 TinyShapes()
144 : ShapeDataset("Shape",
145 {
146 // Batch size 1
147 TensorShape{ 9U, 9U },
148 TensorShape{ 27U, 13U, 2U },
149 })
150 {
151 }
152};
153/** Data set containing small tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100154class SmallShapes final : public ShapeDataset
155{
156public:
157 SmallShapes()
158 : ShapeDataset("Shape",
159 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100160 // Batch size 1
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100161 TensorShape{ 9U, 9U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100162 TensorShape{ 27U, 13U, 2U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100163 TensorShape{ 128U, 64U, 1U, 3U },
164 // Batch size 4
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100165 TensorShape{ 9U, 9U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100166 TensorShape{ 27U, 13U, 2U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100167 // Arbitrary batch size
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100168 TensorShape{ 9U, 9U, 3U, 5U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100169 })
170 {
171 }
172};
173
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000174/** Data set containing pairs of small tensor shapes that are broadcast compatible. */
175class SmallShapesBroadcast final : public framework::dataset::ZipDataset<ShapeDataset, ShapeDataset>
176{
177public:
178 SmallShapesBroadcast()
179 : ZipDataset<ShapeDataset, ShapeDataset>(
180 ShapeDataset("Shape0",
181 {
182 TensorShape{ 9U, 9U },
183 TensorShape{ 27U, 13U, 2U },
184 TensorShape{ 128U, 1U, 5U, 3U },
185 TensorShape{ 9U, 9U, 3U, 4U },
186 TensorShape{ 27U, 13U, 2U, 4U },
187 TensorShape{ 1U, 1U, 1U, 5U }
188 }),
189 ShapeDataset("Shape1",
190 {
191 TensorShape{ 9U, 1U, 2U },
192 TensorShape{ 1U, 13U, 2U },
193 TensorShape{ 128U, 64U, 1U, 3U },
194 TensorShape{ 9U, 1U, 3U },
195 TensorShape{ 1U },
196 TensorShape{ 9U, 9U, 3U, 5U }
197 }))
198 {
199 }
200};
201
steniu01f81652d2017-09-11 15:29:12 +0100202/** Data set containing medium tensor shapes. */
203class MediumShapes final : public ShapeDataset
204{
205public:
206 MediumShapes()
207 : ShapeDataset("Shape",
208 {
209 // Batch size 1
210 TensorShape{ 37U, 37U },
211 TensorShape{ 27U, 33U, 2U },
212 TensorShape{ 128U, 64U, 1U, 3U },
213 // Batch size 4
214 TensorShape{ 37U, 37U, 3U, 4U },
215 TensorShape{ 27U, 33U, 2U, 4U },
216 // Arbitrary batch size
217 TensorShape{ 37U, 37U, 3U, 5U }
218 })
219 {
220 }
221};
222
Gian Marco37908d92017-11-07 14:38:22 +0000223/** Data set containing medium 2D tensor shapes. */
224class Medium2DShapes final : public ShapeDataset
225{
226public:
227 Medium2DShapes()
228 : ShapeDataset("Shape",
229 {
230 TensorShape{ 42U, 37U },
231 TensorShape{ 57U, 60U },
232 TensorShape{ 128U, 64U },
233 TensorShape{ 83U, 72U }
234 })
235 {
236 }
237};
238
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100239/** Data set containing large tensor shapes. */
240class LargeShapes final : public ShapeDataset
241{
242public:
243 LargeShapes()
244 : ShapeDataset("Shape",
245 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100246 // Batch size 1
Gian Marco7f0f7902017-12-07 09:26:56 +0000247 TensorShape{ 1921U, 1083U },
248 TensorShape{ 641U, 485U, 2U, 3U },
249 TensorShape{ 4159U, 3117U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100250 // Batch size 4
Gian Marco7f0f7902017-12-07 09:26:56 +0000251 TensorShape{ 799U, 595U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100252 })
253 {
254 }
255};
256
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000257/** Data set containing pairs of large tensor shapes that are broadcast compatible. */
258class LargeShapesBroadcast final : public framework::dataset::ZipDataset<ShapeDataset, ShapeDataset>
259{
260public:
261 LargeShapesBroadcast()
262 : ZipDataset<ShapeDataset, ShapeDataset>(
263 ShapeDataset("Shape0",
264 {
265 TensorShape{ 1921U, 541U },
266 TensorShape{ 1U, 485U, 2U, 3U },
267 TensorShape{ 4159U, 1U },
268 TensorShape{ 799U }
269 }),
270 ShapeDataset("Shape1",
271 {
272 TensorShape{ 1921U, 1U, 2U },
Georgios Pinitasced7a8d2018-02-01 16:31:33 +0000273 TensorShape{ 1921U, 1U, 2U },
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000274 TensorShape{ 641U, 1U, 2U, 3U },
275 TensorShape{ 1U, 127U, 25U },
276 TensorShape{ 799U, 595U, 1U, 4U }
277 }))
278 {
279 }
280};
281
Gian Marco5420b282017-11-29 10:41:38 +0000282/** Data set containing large 1D tensor shapes. */
283class Large1DShapes final : public ShapeDataset
284{
285public:
286 Large1DShapes()
287 : ShapeDataset("Shape",
288 {
289 TensorShape{ 1921U },
290 TensorShape{ 1245U },
291 TensorShape{ 4160U }
292 })
293 {
294 }
295};
296
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100297/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100298class Large2DShapes final : public ShapeDataset
299{
300public:
301 Large2DShapes()
302 : ShapeDataset("Shape",
303 {
304 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100305 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100306 TensorShape{ 4160U, 3120U }
307 })
308 {
309 }
310};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100311
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100312/** Data set containing large 3D tensor shapes. */
313class Large3DShapes final : public ShapeDataset
314{
315public:
316 Large3DShapes()
317 : ShapeDataset("Shape",
318 {
319 TensorShape{ 320U, 240U, 3U },
320 TensorShape{ 383U, 653U, 2U },
321 TensorShape{ 721U, 123U, 13U }
322 })
323 {
324 }
325};
326
327/** Data set containing large 4D tensor shapes. */
328class Large4DShapes final : public ShapeDataset
329{
330public:
331 Large4DShapes()
332 : ShapeDataset("Shape",
333 {
334 TensorShape{ 320U, 123U, 3U, 3U },
335 TensorShape{ 383U, 413U, 2U, 3U },
336 TensorShape{ 517U, 123U, 13U, 2U }
337 })
338 {
339 }
340};
341
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100342/** Data set containing small tensor shapes for deconvolution. */
343class SmallDeconvolutionShapes final : public ShapeDataset
344{
345public:
346 SmallDeconvolutionShapes()
347 : ShapeDataset("InputShape",
348 {
Georgios Pinitasced7a8d2018-02-01 16:31:33 +0000349 TensorShape{ 5U, 4U, 3U, 2U },
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100350 TensorShape{ 5U, 5U, 3U },
351 TensorShape{ 11U, 13U, 4U, 3U }
352 })
353 {
354 }
355};
356
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000357/** Data set containing tiny tensor shapes for direct convolution. */
358class TinyDirectConvolutionShapes final : public ShapeDataset
359{
360public:
361 TinyDirectConvolutionShapes()
362 : ShapeDataset("InputShape",
363 {
364 // Batch size 1
365 TensorShape{ 11U, 13U, 3U },
366 TensorShape{ 7U, 27U, 3U }
367 })
368 {
369 }
370};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100371/** Data set containing small tensor shapes for direct convolution. */
372class SmallDirectConvolutionShapes final : public ShapeDataset
373{
374public:
375 SmallDirectConvolutionShapes()
376 : ShapeDataset("InputShape",
377 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100378 // Batch size 1
steniu01f81652d2017-09-11 15:29:12 +0100379 TensorShape{ 35U, 35U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100380 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100381 // Batch size 4
SiCong Licaf8c5e2017-08-21 13:12:52 +0100382 TensorShape{ 32U, 37U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100383 // Batch size 8
SiCong Licaf8c5e2017-08-21 13:12:52 +0100384 TensorShape{ 32U, 37U, 3U, 8U },
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000385 TensorShape{ 33U, 35U, 8U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100386 })
387 {
388 }
389};
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100390
Xinghang Zhou33ff9ef2018-01-17 11:23:39 +0800391/** Data set containing small tensor shapes for direct convolution. */
392class SmallDirectConvolutionTensorShiftShapes final : public ShapeDataset
393{
394public:
395 SmallDirectConvolutionTensorShiftShapes()
396 : ShapeDataset("InputShape",
397 {
398 // Batch size 1
399 TensorShape{ 35U, 35U, 3U },
400 TensorShape{ 32U, 37U, 3U },
401 // Batch size 4
402 TensorShape{ 32U, 37U, 3U, 4U },
403 // Batch size 8
404 TensorShape{ 32U, 37U, 3U, 8U },
405 TensorShape{ 33U, 35U, 3U, 8U },
406 // Arbitrary batch size
407 TensorShape{ 32U, 37U, 3U, 8U }
408 })
409 {
410 }
411};
412
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000413/** Data set containing 2D tensor shapes for DepthConcatenateLayer. */
414class DepthConcatenateLayerShapes final : public ShapeDataset
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100415{
416public:
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000417 DepthConcatenateLayerShapes()
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100418 : ShapeDataset("Shape",
419 {
420 TensorShape{ 322U, 243U },
421 TensorShape{ 463U, 879U },
422 TensorShape{ 416U, 651U }
423 })
424 {
425 }
426};
427
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100428/** Data set containing global pooling tensor shapes. */
429class GlobalPoolingShapes final : public ShapeDataset
430{
431public:
432 GlobalPoolingShapes()
433 : ShapeDataset("Shape",
434 {
435 // Batch size 1
436 TensorShape{ 9U, 9U },
437 TensorShape{ 13U, 13U, 2U },
438 TensorShape{ 27U, 27U, 1U, 3U },
439 // Batch size 4
440 TensorShape{ 31U, 31U, 3U, 4U },
441 TensorShape{ 34U, 34U, 2U, 4U }
442 })
443 {
444 }
445};
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000446/** Data set containing tiny softmax layer shapes. */
447class SoftmaxLayerTinyShapes final : public ShapeDataset
448{
449public:
450 SoftmaxLayerTinyShapes()
451 : ShapeDataset("Shape",
452 {
453 TensorShape{ 9U, 9U },
454 TensorShape{ 128U, 10U, 2U },
455 })
456 {
457 }
458};
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100459
Chunosovd6afedc2017-11-06 22:09:45 +0700460/** Data set containing small softmax layer shapes. */
461class SoftmaxLayerSmallShapes final : public ShapeDataset
462{
463public:
464 SoftmaxLayerSmallShapes()
465 : ShapeDataset("Shape",
466 {
467 TensorShape{ 9U, 9U },
468 TensorShape{ 256U, 10U, 2U },
469 TensorShape{ 353U, 8U, 2U, 2U },
470 TensorShape{ 512U, 7U, 2U, 2U },
471 TensorShape{ 633U, 10U, 1U, 2U },
472 TensorShape{ 781U, 5U, 2U },
473 })
474 {
475 }
476};
477
478/** Data set containing large softmax layer shapes. */
479class SoftmaxLayerLargeShapes final : public ShapeDataset
480{
481public:
482 SoftmaxLayerLargeShapes()
483 : ShapeDataset("Shape",
484 {
485 TensorShape{ 1000U, 10U },
486 TensorShape{ 3989U, 10U, 2U },
487 TensorShape{ 4098U, 8U, 1U, 2U },
488 TensorShape{ 7339U, 11U },
489 })
490 {
491 }
492};
493
Ioan-Cristian Szabo2c350182017-12-20 16:27:37 +0000494/** Data set containing 2D tensor shapes relative to an image size. */
495class SmallImageShapes final : public ShapeDataset
496{
497public:
498 SmallImageShapes()
499 : ShapeDataset("Shape",
500 {
501 TensorShape{ 640U, 480U },
502 TensorShape{ 800U, 600U },
503 TensorShape{ 1200U, 800U }
504 })
505 {
506 }
507};
508
509/** Data set containing 2D tensor shapes relative to an image size. */
510class LargeImageShapes final : public ShapeDataset
511{
512public:
513 LargeImageShapes()
514 : ShapeDataset("Shape",
515 {
516 TensorShape{ 1920U, 1080U },
517 TensorShape{ 2560U, 1536U },
518 TensorShape{ 3584U, 2048U }
519 })
520 {
521 }
522};
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100523} // namespace datasets
524} // namespace test
525} // namespace arm_compute
526#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */