blob: 4b563708e188752724800c64ef30ef1c6e7d2885 [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 {
Georgios Pinitas02ee4292018-02-15 17:22:36 +0000103 TensorShape{ 1U, 7U, 7U },
104 TensorShape{ 7U, 7U, 5U },
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100105 TensorShape{ 27U, 13U, 37U },
106 TensorShape{ 128U, 64U, 21U }
107 })
108 {
109 }
110};
111
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000112/** Data set containing tiny 4D tensor shapes. */
113class Tiny4DShapes final : public ShapeDataset
114{
115public:
116 Tiny4DShapes()
117 : ShapeDataset("Shape",
118 {
119 TensorShape{ 7U, 7U, 5U, 3U },
120 TensorShape{ 17U, 13U, 7U, 2U },
121 })
122 {
123 }
124};
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100125/** Data set containing small 4D tensor shapes. */
126class Small4DShapes final : public ShapeDataset
127{
128public:
129 Small4DShapes()
130 : ShapeDataset("Shape",
131 {
Georgios Pinitas02ee4292018-02-15 17:22:36 +0000132 TensorShape{ 1U, 7U, 1U, 3U },
133 TensorShape{ 7U, 7U, 5U, 3U },
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100134 TensorShape{ 27U, 13U, 37U, 2U },
135 TensorShape{ 128U, 64U, 21U, 3U }
136 })
137 {
138 }
139};
140
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100141/** Data set containing small tensor shapes. */
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000142class TinyShapes final : public ShapeDataset
143{
144public:
145 TinyShapes()
146 : ShapeDataset("Shape",
147 {
148 // Batch size 1
149 TensorShape{ 9U, 9U },
150 TensorShape{ 27U, 13U, 2U },
151 })
152 {
153 }
154};
155/** Data set containing small tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100156class SmallShapes final : public ShapeDataset
157{
158public:
159 SmallShapes()
160 : ShapeDataset("Shape",
161 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100162 // Batch size 1
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100163 TensorShape{ 9U, 9U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100164 TensorShape{ 27U, 13U, 2U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100165 TensorShape{ 128U, 64U, 1U, 3U },
166 // Batch size 4
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100167 TensorShape{ 9U, 9U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100168 TensorShape{ 27U, 13U, 2U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100169 // Arbitrary batch size
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100170 TensorShape{ 9U, 9U, 3U, 5U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100171 })
172 {
173 }
174};
175
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000176/** Data set containing pairs of small tensor shapes that are broadcast compatible. */
177class SmallShapesBroadcast final : public framework::dataset::ZipDataset<ShapeDataset, ShapeDataset>
178{
179public:
180 SmallShapesBroadcast()
181 : ZipDataset<ShapeDataset, ShapeDataset>(
182 ShapeDataset("Shape0",
183 {
184 TensorShape{ 9U, 9U },
185 TensorShape{ 27U, 13U, 2U },
186 TensorShape{ 128U, 1U, 5U, 3U },
187 TensorShape{ 9U, 9U, 3U, 4U },
188 TensorShape{ 27U, 13U, 2U, 4U },
189 TensorShape{ 1U, 1U, 1U, 5U }
190 }),
191 ShapeDataset("Shape1",
192 {
193 TensorShape{ 9U, 1U, 2U },
194 TensorShape{ 1U, 13U, 2U },
195 TensorShape{ 128U, 64U, 1U, 3U },
196 TensorShape{ 9U, 1U, 3U },
197 TensorShape{ 1U },
198 TensorShape{ 9U, 9U, 3U, 5U }
199 }))
200 {
201 }
202};
203
steniu01f81652d2017-09-11 15:29:12 +0100204/** Data set containing medium tensor shapes. */
205class MediumShapes final : public ShapeDataset
206{
207public:
208 MediumShapes()
209 : ShapeDataset("Shape",
210 {
211 // Batch size 1
212 TensorShape{ 37U, 37U },
213 TensorShape{ 27U, 33U, 2U },
214 TensorShape{ 128U, 64U, 1U, 3U },
215 // Batch size 4
216 TensorShape{ 37U, 37U, 3U, 4U },
217 TensorShape{ 27U, 33U, 2U, 4U },
218 // Arbitrary batch size
219 TensorShape{ 37U, 37U, 3U, 5U }
220 })
221 {
222 }
223};
224
Gian Marco37908d92017-11-07 14:38:22 +0000225/** Data set containing medium 2D tensor shapes. */
226class Medium2DShapes final : public ShapeDataset
227{
228public:
229 Medium2DShapes()
230 : ShapeDataset("Shape",
231 {
232 TensorShape{ 42U, 37U },
233 TensorShape{ 57U, 60U },
234 TensorShape{ 128U, 64U },
235 TensorShape{ 83U, 72U }
236 })
237 {
238 }
239};
240
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100241/** Data set containing large tensor shapes. */
242class LargeShapes final : public ShapeDataset
243{
244public:
245 LargeShapes()
246 : ShapeDataset("Shape",
247 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100248 // Batch size 1
Gian Marco7f0f7902017-12-07 09:26:56 +0000249 TensorShape{ 1921U, 1083U },
250 TensorShape{ 641U, 485U, 2U, 3U },
251 TensorShape{ 4159U, 3117U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100252 // Batch size 4
Gian Marco7f0f7902017-12-07 09:26:56 +0000253 TensorShape{ 799U, 595U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100254 })
255 {
256 }
257};
258
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000259/** Data set containing pairs of large tensor shapes that are broadcast compatible. */
260class LargeShapesBroadcast final : public framework::dataset::ZipDataset<ShapeDataset, ShapeDataset>
261{
262public:
263 LargeShapesBroadcast()
264 : ZipDataset<ShapeDataset, ShapeDataset>(
265 ShapeDataset("Shape0",
266 {
267 TensorShape{ 1921U, 541U },
268 TensorShape{ 1U, 485U, 2U, 3U },
269 TensorShape{ 4159U, 1U },
270 TensorShape{ 799U }
271 }),
272 ShapeDataset("Shape1",
273 {
274 TensorShape{ 1921U, 1U, 2U },
275 TensorShape{ 641U, 1U, 2U, 3U },
276 TensorShape{ 1U, 127U, 25U },
277 TensorShape{ 799U, 595U, 1U, 4U }
278 }))
279 {
280 }
281};
282
Gian Marco5420b282017-11-29 10:41:38 +0000283/** Data set containing large 1D tensor shapes. */
284class Large1DShapes final : public ShapeDataset
285{
286public:
287 Large1DShapes()
288 : ShapeDataset("Shape",
289 {
290 TensorShape{ 1921U },
291 TensorShape{ 1245U },
292 TensorShape{ 4160U }
293 })
294 {
295 }
296};
297
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100298/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100299class Large2DShapes final : public ShapeDataset
300{
301public:
302 Large2DShapes()
303 : ShapeDataset("Shape",
304 {
305 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100306 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100307 TensorShape{ 4160U, 3120U }
308 })
309 {
310 }
311};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100312
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100313/** Data set containing large 3D tensor shapes. */
314class Large3DShapes final : public ShapeDataset
315{
316public:
317 Large3DShapes()
318 : ShapeDataset("Shape",
319 {
320 TensorShape{ 320U, 240U, 3U },
321 TensorShape{ 383U, 653U, 2U },
322 TensorShape{ 721U, 123U, 13U }
323 })
324 {
325 }
326};
327
328/** Data set containing large 4D tensor shapes. */
329class Large4DShapes final : public ShapeDataset
330{
331public:
332 Large4DShapes()
333 : ShapeDataset("Shape",
334 {
335 TensorShape{ 320U, 123U, 3U, 3U },
336 TensorShape{ 383U, 413U, 2U, 3U },
337 TensorShape{ 517U, 123U, 13U, 2U }
338 })
339 {
340 }
341};
342
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100343/** Data set containing small tensor shapes for deconvolution. */
344class SmallDeconvolutionShapes final : public ShapeDataset
345{
346public:
347 SmallDeconvolutionShapes()
348 : ShapeDataset("InputShape",
349 {
Georgios Pinitasced7a8d2018-02-01 16:31:33 +0000350 TensorShape{ 5U, 4U, 3U, 2U },
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100351 TensorShape{ 5U, 5U, 3U },
352 TensorShape{ 11U, 13U, 4U, 3U }
353 })
354 {
355 }
356};
357
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000358/** Data set containing tiny tensor shapes for direct convolution. */
359class TinyDirectConvolutionShapes final : public ShapeDataset
360{
361public:
362 TinyDirectConvolutionShapes()
363 : ShapeDataset("InputShape",
364 {
365 // Batch size 1
366 TensorShape{ 11U, 13U, 3U },
367 TensorShape{ 7U, 27U, 3U }
368 })
369 {
370 }
371};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100372/** Data set containing small tensor shapes for direct convolution. */
373class SmallDirectConvolutionShapes final : public ShapeDataset
374{
375public:
376 SmallDirectConvolutionShapes()
377 : ShapeDataset("InputShape",
378 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100379 // Batch size 1
steniu01f81652d2017-09-11 15:29:12 +0100380 TensorShape{ 35U, 35U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100381 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100382 // Batch size 4
SiCong Licaf8c5e2017-08-21 13:12:52 +0100383 TensorShape{ 32U, 37U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100384 // Batch size 8
SiCong Licaf8c5e2017-08-21 13:12:52 +0100385 TensorShape{ 32U, 37U, 3U, 8U },
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000386 TensorShape{ 33U, 35U, 8U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100387 })
388 {
389 }
390};
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100391
Xinghang Zhou33ff9ef2018-01-17 11:23:39 +0800392/** Data set containing small tensor shapes for direct convolution. */
393class SmallDirectConvolutionTensorShiftShapes final : public ShapeDataset
394{
395public:
396 SmallDirectConvolutionTensorShiftShapes()
397 : ShapeDataset("InputShape",
398 {
399 // Batch size 1
400 TensorShape{ 35U, 35U, 3U },
401 TensorShape{ 32U, 37U, 3U },
402 // Batch size 4
403 TensorShape{ 32U, 37U, 3U, 4U },
404 // Batch size 8
405 TensorShape{ 32U, 37U, 3U, 8U },
406 TensorShape{ 33U, 35U, 3U, 8U },
407 // Arbitrary batch size
408 TensorShape{ 32U, 37U, 3U, 8U }
409 })
410 {
411 }
412};
413
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000414/** Data set containing 2D tensor shapes for DepthConcatenateLayer. */
415class DepthConcatenateLayerShapes final : public ShapeDataset
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100416{
417public:
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000418 DepthConcatenateLayerShapes()
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100419 : ShapeDataset("Shape",
420 {
421 TensorShape{ 322U, 243U },
422 TensorShape{ 463U, 879U },
423 TensorShape{ 416U, 651U }
424 })
425 {
426 }
427};
428
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100429/** Data set containing global pooling tensor shapes. */
430class GlobalPoolingShapes final : public ShapeDataset
431{
432public:
433 GlobalPoolingShapes()
434 : ShapeDataset("Shape",
435 {
436 // Batch size 1
437 TensorShape{ 9U, 9U },
438 TensorShape{ 13U, 13U, 2U },
439 TensorShape{ 27U, 27U, 1U, 3U },
440 // Batch size 4
441 TensorShape{ 31U, 31U, 3U, 4U },
442 TensorShape{ 34U, 34U, 2U, 4U }
443 })
444 {
445 }
446};
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +0000447/** Data set containing tiny softmax layer shapes. */
448class SoftmaxLayerTinyShapes final : public ShapeDataset
449{
450public:
451 SoftmaxLayerTinyShapes()
452 : ShapeDataset("Shape",
453 {
454 TensorShape{ 9U, 9U },
455 TensorShape{ 128U, 10U, 2U },
456 })
457 {
458 }
459};
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100460
Chunosovd6afedc2017-11-06 22:09:45 +0700461/** Data set containing small softmax layer shapes. */
462class SoftmaxLayerSmallShapes final : public ShapeDataset
463{
464public:
465 SoftmaxLayerSmallShapes()
466 : ShapeDataset("Shape",
467 {
468 TensorShape{ 9U, 9U },
469 TensorShape{ 256U, 10U, 2U },
470 TensorShape{ 353U, 8U, 2U, 2U },
471 TensorShape{ 512U, 7U, 2U, 2U },
472 TensorShape{ 633U, 10U, 1U, 2U },
473 TensorShape{ 781U, 5U, 2U },
474 })
475 {
476 }
477};
478
479/** Data set containing large softmax layer shapes. */
480class SoftmaxLayerLargeShapes final : public ShapeDataset
481{
482public:
483 SoftmaxLayerLargeShapes()
484 : ShapeDataset("Shape",
485 {
486 TensorShape{ 1000U, 10U },
487 TensorShape{ 3989U, 10U, 2U },
488 TensorShape{ 4098U, 8U, 1U, 2U },
489 TensorShape{ 7339U, 11U },
490 })
491 {
492 }
493};
494
Ioan-Cristian Szabo2c350182017-12-20 16:27:37 +0000495/** Data set containing 2D tensor shapes relative to an image size. */
496class SmallImageShapes final : public ShapeDataset
497{
498public:
499 SmallImageShapes()
500 : ShapeDataset("Shape",
501 {
502 TensorShape{ 640U, 480U },
503 TensorShape{ 800U, 600U },
504 TensorShape{ 1200U, 800U }
505 })
506 {
507 }
508};
509
510/** Data set containing 2D tensor shapes relative to an image size. */
511class LargeImageShapes final : public ShapeDataset
512{
513public:
514 LargeImageShapes()
515 : ShapeDataset("Shape",
516 {
517 TensorShape{ 1920U, 1080U },
518 TensorShape{ 2560U, 1536U },
519 TensorShape{ 3584U, 2048U }
520 })
521 {
522 }
523};
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100524} // namespace datasets
525} // namespace test
526} // namespace arm_compute
527#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */