blob: c9e551076080ec88872a251f17a04cce9ef09bfb [file] [log] [blame]
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
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
steniu01f81652d2017-09-11 15:29:12 +0100120/** Data set containing medium tensor shapes. */
121class MediumShapes final : public ShapeDataset
122{
123public:
124 MediumShapes()
125 : ShapeDataset("Shape",
126 {
127 // Batch size 1
128 TensorShape{ 37U, 37U },
129 TensorShape{ 27U, 33U, 2U },
130 TensorShape{ 128U, 64U, 1U, 3U },
131 // Batch size 4
132 TensorShape{ 37U, 37U, 3U, 4U },
133 TensorShape{ 27U, 33U, 2U, 4U },
134 // Arbitrary batch size
135 TensorShape{ 37U, 37U, 3U, 5U }
136 })
137 {
138 }
139};
140
Gian Marco37908d92017-11-07 14:38:22 +0000141/** Data set containing medium 2D tensor shapes. */
142class Medium2DShapes final : public ShapeDataset
143{
144public:
145 Medium2DShapes()
146 : ShapeDataset("Shape",
147 {
148 TensorShape{ 42U, 37U },
149 TensorShape{ 57U, 60U },
150 TensorShape{ 128U, 64U },
151 TensorShape{ 83U, 72U }
152 })
153 {
154 }
155};
156
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100157/** Data set containing large tensor shapes. */
158class LargeShapes final : public ShapeDataset
159{
160public:
161 LargeShapes()
162 : ShapeDataset("Shape",
163 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100164 // Batch size 1
Gian Marco7f0f7902017-12-07 09:26:56 +0000165 TensorShape{ 1921U, 1083U },
166 TensorShape{ 641U, 485U, 2U, 3U },
167 TensorShape{ 4159U, 3117U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100168 // Batch size 4
Gian Marco7f0f7902017-12-07 09:26:56 +0000169 TensorShape{ 799U, 595U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100170 })
171 {
172 }
173};
174
Gian Marco5420b282017-11-29 10:41:38 +0000175/** Data set containing large 1D tensor shapes. */
176class Large1DShapes final : public ShapeDataset
177{
178public:
179 Large1DShapes()
180 : ShapeDataset("Shape",
181 {
182 TensorShape{ 1921U },
183 TensorShape{ 1245U },
184 TensorShape{ 4160U }
185 })
186 {
187 }
188};
189
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100190/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100191class Large2DShapes final : public ShapeDataset
192{
193public:
194 Large2DShapes()
195 : ShapeDataset("Shape",
196 {
197 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100198 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100199 TensorShape{ 4160U, 3120U }
200 })
201 {
202 }
203};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100204
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100205/** Data set containing large 3D tensor shapes. */
206class Large3DShapes final : public ShapeDataset
207{
208public:
209 Large3DShapes()
210 : ShapeDataset("Shape",
211 {
212 TensorShape{ 320U, 240U, 3U },
213 TensorShape{ 383U, 653U, 2U },
214 TensorShape{ 721U, 123U, 13U }
215 })
216 {
217 }
218};
219
220/** Data set containing large 4D tensor shapes. */
221class Large4DShapes final : public ShapeDataset
222{
223public:
224 Large4DShapes()
225 : ShapeDataset("Shape",
226 {
227 TensorShape{ 320U, 123U, 3U, 3U },
228 TensorShape{ 383U, 413U, 2U, 3U },
229 TensorShape{ 517U, 123U, 13U, 2U }
230 })
231 {
232 }
233};
234
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100235/** Data set containing small tensor shapes for deconvolution. */
236class SmallDeconvolutionShapes final : public ShapeDataset
237{
238public:
239 SmallDeconvolutionShapes()
240 : ShapeDataset("InputShape",
241 {
242 TensorShape{ 2U, 3U, 3U, 2U },
243 TensorShape{ 5U, 5U, 3U },
244 TensorShape{ 11U, 13U, 4U, 3U }
245 })
246 {
247 }
248};
249
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100250/** Data set containing small tensor shapes for direct convolution. */
251class SmallDirectConvolutionShapes final : public ShapeDataset
252{
253public:
254 SmallDirectConvolutionShapes()
255 : ShapeDataset("InputShape",
256 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100257 // Batch size 1
steniu01f81652d2017-09-11 15:29:12 +0100258 TensorShape{ 35U, 35U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100259 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100260 // Batch size 4
SiCong Licaf8c5e2017-08-21 13:12:52 +0100261 TensorShape{ 32U, 37U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100262 // Batch size 8
SiCong Licaf8c5e2017-08-21 13:12:52 +0100263 TensorShape{ 32U, 37U, 3U, 8U },
steniu01f81652d2017-09-11 15:29:12 +0100264 TensorShape{ 33U, 35U, 8U, 8U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100265 // Arbitrary batch size
266 TensorShape{ 32U, 37U, 3U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100267 })
268 {
269 }
270};
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100271
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000272/** Data set containing 2D tensor shapes for DepthConcatenateLayer. */
273class DepthConcatenateLayerShapes final : public ShapeDataset
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100274{
275public:
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000276 DepthConcatenateLayerShapes()
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100277 : ShapeDataset("Shape",
278 {
279 TensorShape{ 322U, 243U },
280 TensorShape{ 463U, 879U },
281 TensorShape{ 416U, 651U }
282 })
283 {
284 }
285};
286
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100287/** Data set containing global pooling tensor shapes. */
288class GlobalPoolingShapes final : public ShapeDataset
289{
290public:
291 GlobalPoolingShapes()
292 : ShapeDataset("Shape",
293 {
294 // Batch size 1
295 TensorShape{ 9U, 9U },
296 TensorShape{ 13U, 13U, 2U },
297 TensorShape{ 27U, 27U, 1U, 3U },
298 // Batch size 4
299 TensorShape{ 31U, 31U, 3U, 4U },
300 TensorShape{ 34U, 34U, 2U, 4U }
301 })
302 {
303 }
304};
305
Chunosovd6afedc2017-11-06 22:09:45 +0700306/** Data set containing small softmax layer shapes. */
307class SoftmaxLayerSmallShapes final : public ShapeDataset
308{
309public:
310 SoftmaxLayerSmallShapes()
311 : ShapeDataset("Shape",
312 {
313 TensorShape{ 9U, 9U },
314 TensorShape{ 256U, 10U, 2U },
315 TensorShape{ 353U, 8U, 2U, 2U },
316 TensorShape{ 512U, 7U, 2U, 2U },
317 TensorShape{ 633U, 10U, 1U, 2U },
318 TensorShape{ 781U, 5U, 2U },
319 })
320 {
321 }
322};
323
324/** Data set containing large softmax layer shapes. */
325class SoftmaxLayerLargeShapes final : public ShapeDataset
326{
327public:
328 SoftmaxLayerLargeShapes()
329 : ShapeDataset("Shape",
330 {
331 TensorShape{ 1000U, 10U },
332 TensorShape{ 3989U, 10U, 2U },
333 TensorShape{ 4098U, 8U, 1U, 2U },
334 TensorShape{ 7339U, 11U },
335 })
336 {
337 }
338};
339
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100340} // namespace datasets
341} // namespace test
342} // namespace arm_compute
343#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */