blob: 79e052c69726241a5b10a7d9234ae5c53a7df7b5 [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
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010054/** Data set containing small 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010055class Small2DShapes final : public ShapeDataset
56{
57public:
58 Small2DShapes()
59 : ShapeDataset("Shape",
60 {
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010061 TensorShape{ 7U, 7U },
62 TensorShape{ 27U, 13U },
63 TensorShape{ 128U, 64U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010064 })
65 {
66 }
67};
68
Gian Marco Iodice06b184a2017-08-29 16:05:25 +010069/** Data set containing small 3D tensor shapes. */
70class Small3DShapes final : public ShapeDataset
71{
72public:
73 Small3DShapes()
74 : ShapeDataset("Shape",
75 {
76 TensorShape{ 7U, 7U, 5U },
77 TensorShape{ 27U, 13U, 37U },
78 TensorShape{ 128U, 64U, 21U }
79 })
80 {
81 }
82};
83
84/** Data set containing small 4D tensor shapes. */
85class Small4DShapes final : public ShapeDataset
86{
87public:
88 Small4DShapes()
89 : ShapeDataset("Shape",
90 {
91 TensorShape{ 7U, 7U, 5U, 3U },
92 TensorShape{ 27U, 13U, 37U, 2U },
93 TensorShape{ 128U, 64U, 21U, 3U }
94 })
95 {
96 }
97};
98
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010099/** Data set containing small tensor shapes. */
100class SmallShapes final : public ShapeDataset
101{
102public:
103 SmallShapes()
104 : ShapeDataset("Shape",
105 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100106 // Batch size 1
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100107 TensorShape{ 9U, 9U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100108 TensorShape{ 27U, 13U, 2U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100109 TensorShape{ 128U, 64U, 1U, 3U },
110 // Batch size 4
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100111 TensorShape{ 9U, 9U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100112 TensorShape{ 27U, 13U, 2U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100113 // Arbitrary batch size
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100114 TensorShape{ 9U, 9U, 3U, 5U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100115 })
116 {
117 }
118};
119
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000120/** Data set containing pairs of small tensor shapes that are broadcast compatible. */
121class SmallShapesBroadcast final : public framework::dataset::ZipDataset<ShapeDataset, ShapeDataset>
122{
123public:
124 SmallShapesBroadcast()
125 : ZipDataset<ShapeDataset, ShapeDataset>(
126 ShapeDataset("Shape0",
127 {
128 TensorShape{ 9U, 9U },
129 TensorShape{ 27U, 13U, 2U },
130 TensorShape{ 128U, 1U, 5U, 3U },
131 TensorShape{ 9U, 9U, 3U, 4U },
132 TensorShape{ 27U, 13U, 2U, 4U },
133 TensorShape{ 1U, 1U, 1U, 5U }
134 }),
135 ShapeDataset("Shape1",
136 {
137 TensorShape{ 9U, 1U, 2U },
138 TensorShape{ 1U, 13U, 2U },
139 TensorShape{ 128U, 64U, 1U, 3U },
140 TensorShape{ 9U, 1U, 3U },
141 TensorShape{ 1U },
142 TensorShape{ 9U, 9U, 3U, 5U }
143 }))
144 {
145 }
146};
147
steniu01f81652d2017-09-11 15:29:12 +0100148/** Data set containing medium tensor shapes. */
149class MediumShapes final : public ShapeDataset
150{
151public:
152 MediumShapes()
153 : ShapeDataset("Shape",
154 {
155 // Batch size 1
156 TensorShape{ 37U, 37U },
157 TensorShape{ 27U, 33U, 2U },
158 TensorShape{ 128U, 64U, 1U, 3U },
159 // Batch size 4
160 TensorShape{ 37U, 37U, 3U, 4U },
161 TensorShape{ 27U, 33U, 2U, 4U },
162 // Arbitrary batch size
163 TensorShape{ 37U, 37U, 3U, 5U }
164 })
165 {
166 }
167};
168
Gian Marco37908d92017-11-07 14:38:22 +0000169/** Data set containing medium 2D tensor shapes. */
170class Medium2DShapes final : public ShapeDataset
171{
172public:
173 Medium2DShapes()
174 : ShapeDataset("Shape",
175 {
176 TensorShape{ 42U, 37U },
177 TensorShape{ 57U, 60U },
178 TensorShape{ 128U, 64U },
179 TensorShape{ 83U, 72U }
180 })
181 {
182 }
183};
184
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100185/** Data set containing large tensor shapes. */
186class LargeShapes final : public ShapeDataset
187{
188public:
189 LargeShapes()
190 : ShapeDataset("Shape",
191 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100192 // Batch size 1
Gian Marco7f0f7902017-12-07 09:26:56 +0000193 TensorShape{ 1921U, 1083U },
194 TensorShape{ 641U, 485U, 2U, 3U },
195 TensorShape{ 4159U, 3117U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100196 // Batch size 4
Gian Marco7f0f7902017-12-07 09:26:56 +0000197 TensorShape{ 799U, 595U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100198 })
199 {
200 }
201};
202
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000203/** Data set containing pairs of large tensor shapes that are broadcast compatible. */
204class LargeShapesBroadcast final : public framework::dataset::ZipDataset<ShapeDataset, ShapeDataset>
205{
206public:
207 LargeShapesBroadcast()
208 : ZipDataset<ShapeDataset, ShapeDataset>(
209 ShapeDataset("Shape0",
210 {
211 TensorShape{ 1921U, 541U },
212 TensorShape{ 1U, 485U, 2U, 3U },
213 TensorShape{ 4159U, 1U },
214 TensorShape{ 799U }
215 }),
216 ShapeDataset("Shape1",
217 {
218 TensorShape{ 1921U, 1U, 2U },
219 TensorShape{ 641U, 1U, 2U, 3U },
220 TensorShape{ 1U, 127U, 25U },
221 TensorShape{ 799U, 595U, 1U, 4U }
222 }))
223 {
224 }
225};
226
Gian Marco5420b282017-11-29 10:41:38 +0000227/** Data set containing large 1D tensor shapes. */
228class Large1DShapes final : public ShapeDataset
229{
230public:
231 Large1DShapes()
232 : ShapeDataset("Shape",
233 {
234 TensorShape{ 1921U },
235 TensorShape{ 1245U },
236 TensorShape{ 4160U }
237 })
238 {
239 }
240};
241
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100242/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100243class Large2DShapes final : public ShapeDataset
244{
245public:
246 Large2DShapes()
247 : ShapeDataset("Shape",
248 {
249 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100250 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100251 TensorShape{ 4160U, 3120U }
252 })
253 {
254 }
255};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100256
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100257/** Data set containing large 3D tensor shapes. */
258class Large3DShapes final : public ShapeDataset
259{
260public:
261 Large3DShapes()
262 : ShapeDataset("Shape",
263 {
264 TensorShape{ 320U, 240U, 3U },
265 TensorShape{ 383U, 653U, 2U },
266 TensorShape{ 721U, 123U, 13U }
267 })
268 {
269 }
270};
271
272/** Data set containing large 4D tensor shapes. */
273class Large4DShapes final : public ShapeDataset
274{
275public:
276 Large4DShapes()
277 : ShapeDataset("Shape",
278 {
279 TensorShape{ 320U, 123U, 3U, 3U },
280 TensorShape{ 383U, 413U, 2U, 3U },
281 TensorShape{ 517U, 123U, 13U, 2U }
282 })
283 {
284 }
285};
286
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100287/** Data set containing small tensor shapes for deconvolution. */
288class SmallDeconvolutionShapes final : public ShapeDataset
289{
290public:
291 SmallDeconvolutionShapes()
292 : ShapeDataset("InputShape",
293 {
Michalis Spyrou780db4e2017-11-23 09:49:51 +0000294 TensorShape{ 4U, 3U, 3U, 2U },
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100295 TensorShape{ 5U, 5U, 3U },
296 TensorShape{ 11U, 13U, 4U, 3U }
297 })
298 {
299 }
300};
301
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100302/** Data set containing small tensor shapes for direct convolution. */
303class SmallDirectConvolutionShapes final : public ShapeDataset
304{
305public:
306 SmallDirectConvolutionShapes()
307 : ShapeDataset("InputShape",
308 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100309 // Batch size 1
steniu01f81652d2017-09-11 15:29:12 +0100310 TensorShape{ 35U, 35U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100311 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100312 // Batch size 4
SiCong Licaf8c5e2017-08-21 13:12:52 +0100313 TensorShape{ 32U, 37U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100314 // Batch size 8
SiCong Licaf8c5e2017-08-21 13:12:52 +0100315 TensorShape{ 32U, 37U, 3U, 8U },
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000316 TensorShape{ 33U, 35U, 8U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100317 })
318 {
319 }
320};
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100321
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000322/** Data set containing 2D tensor shapes for DepthConcatenateLayer. */
323class DepthConcatenateLayerShapes final : public ShapeDataset
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100324{
325public:
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000326 DepthConcatenateLayerShapes()
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100327 : ShapeDataset("Shape",
328 {
329 TensorShape{ 322U, 243U },
330 TensorShape{ 463U, 879U },
331 TensorShape{ 416U, 651U }
332 })
333 {
334 }
335};
336
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100337/** Data set containing global pooling tensor shapes. */
338class GlobalPoolingShapes final : public ShapeDataset
339{
340public:
341 GlobalPoolingShapes()
342 : ShapeDataset("Shape",
343 {
344 // Batch size 1
345 TensorShape{ 9U, 9U },
346 TensorShape{ 13U, 13U, 2U },
347 TensorShape{ 27U, 27U, 1U, 3U },
348 // Batch size 4
349 TensorShape{ 31U, 31U, 3U, 4U },
350 TensorShape{ 34U, 34U, 2U, 4U }
351 })
352 {
353 }
354};
355
Chunosovd6afedc2017-11-06 22:09:45 +0700356/** Data set containing small softmax layer shapes. */
357class SoftmaxLayerSmallShapes final : public ShapeDataset
358{
359public:
360 SoftmaxLayerSmallShapes()
361 : ShapeDataset("Shape",
362 {
363 TensorShape{ 9U, 9U },
364 TensorShape{ 256U, 10U, 2U },
365 TensorShape{ 353U, 8U, 2U, 2U },
366 TensorShape{ 512U, 7U, 2U, 2U },
367 TensorShape{ 633U, 10U, 1U, 2U },
368 TensorShape{ 781U, 5U, 2U },
369 })
370 {
371 }
372};
373
374/** Data set containing large softmax layer shapes. */
375class SoftmaxLayerLargeShapes final : public ShapeDataset
376{
377public:
378 SoftmaxLayerLargeShapes()
379 : ShapeDataset("Shape",
380 {
381 TensorShape{ 1000U, 10U },
382 TensorShape{ 3989U, 10U, 2U },
383 TensorShape{ 4098U, 8U, 1U, 2U },
384 TensorShape{ 7339U, 11U },
385 })
386 {
387 }
388};
389
Ioan-Cristian Szabo2c350182017-12-20 16:27:37 +0000390/** Data set containing 2D tensor shapes relative to an image size. */
391class SmallImageShapes final : public ShapeDataset
392{
393public:
394 SmallImageShapes()
395 : ShapeDataset("Shape",
396 {
397 TensorShape{ 640U, 480U },
398 TensorShape{ 800U, 600U },
399 TensorShape{ 1200U, 800U }
400 })
401 {
402 }
403};
404
405/** Data set containing 2D tensor shapes relative to an image size. */
406class LargeImageShapes final : public ShapeDataset
407{
408public:
409 LargeImageShapes()
410 : ShapeDataset("Shape",
411 {
412 TensorShape{ 1920U, 1080U },
413 TensorShape{ 2560U, 1536U },
414 TensorShape{ 3584U, 2048U }
415 })
416 {
417 }
418};
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100419} // namespace datasets
420} // namespace test
421} // namespace arm_compute
422#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */