blob: 3dc4566e183977158dc10f9ff74ae887ad3bdbd3 [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{
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010038/** Data set containing 1D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010039class Small1DShape final : public framework::dataset::SingletonDataset<TensorShape>
40{
41public:
42 Small1DShape()
43 : SingletonDataset("Shape", TensorShape{ 256U })
44 {
45 }
46};
47
48/** Parent type for all for shape datasets. */
49using ShapeDataset = framework::dataset::ContainerDataset<std::vector<TensorShape>>;
50
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010051/** Data set containing small 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010052class Small2DShapes final : public ShapeDataset
53{
54public:
55 Small2DShapes()
56 : ShapeDataset("Shape",
57 {
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010058 TensorShape{ 7U, 7U },
59 TensorShape{ 27U, 13U },
60 TensorShape{ 128U, 64U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010061 })
62 {
63 }
64};
65
Gian Marco Iodice06b184a2017-08-29 16:05:25 +010066/** Data set containing small 3D tensor shapes. */
67class Small3DShapes final : public ShapeDataset
68{
69public:
70 Small3DShapes()
71 : ShapeDataset("Shape",
72 {
73 TensorShape{ 7U, 7U, 5U },
74 TensorShape{ 27U, 13U, 37U },
75 TensorShape{ 128U, 64U, 21U }
76 })
77 {
78 }
79};
80
81/** Data set containing small 4D tensor shapes. */
82class Small4DShapes final : public ShapeDataset
83{
84public:
85 Small4DShapes()
86 : ShapeDataset("Shape",
87 {
88 TensorShape{ 7U, 7U, 5U, 3U },
89 TensorShape{ 27U, 13U, 37U, 2U },
90 TensorShape{ 128U, 64U, 21U, 3U }
91 })
92 {
93 }
94};
95
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +010096/** Data set containing small tensor shapes. */
97class SmallShapes final : public ShapeDataset
98{
99public:
100 SmallShapes()
101 : ShapeDataset("Shape",
102 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100103 // Batch size 1
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100104 TensorShape{ 9U, 9U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100105 TensorShape{ 27U, 13U, 2U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100106 TensorShape{ 128U, 64U, 1U, 3U },
107 // Batch size 4
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100108 TensorShape{ 9U, 9U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100109 TensorShape{ 27U, 13U, 2U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100110 // Arbitrary batch size
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100111 TensorShape{ 9U, 9U, 3U, 5U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100112 })
113 {
114 }
115};
116
steniu01f81652d2017-09-11 15:29:12 +0100117/** Data set containing medium tensor shapes. */
118class MediumShapes final : public ShapeDataset
119{
120public:
121 MediumShapes()
122 : ShapeDataset("Shape",
123 {
124 // Batch size 1
125 TensorShape{ 37U, 37U },
126 TensorShape{ 27U, 33U, 2U },
127 TensorShape{ 128U, 64U, 1U, 3U },
128 // Batch size 4
129 TensorShape{ 37U, 37U, 3U, 4U },
130 TensorShape{ 27U, 33U, 2U, 4U },
131 // Arbitrary batch size
132 TensorShape{ 37U, 37U, 3U, 5U }
133 })
134 {
135 }
136};
137
Gian Marco37908d92017-11-07 14:38:22 +0000138/** Data set containing medium 2D tensor shapes. */
139class Medium2DShapes final : public ShapeDataset
140{
141public:
142 Medium2DShapes()
143 : ShapeDataset("Shape",
144 {
145 TensorShape{ 42U, 37U },
146 TensorShape{ 57U, 60U },
147 TensorShape{ 128U, 64U },
148 TensorShape{ 83U, 72U }
149 })
150 {
151 }
152};
153
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100154/** Data set containing large tensor shapes. */
155class LargeShapes final : public ShapeDataset
156{
157public:
158 LargeShapes()
159 : ShapeDataset("Shape",
160 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100161 // Batch size 1
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100162 TensorShape{ 1920U, 1080U },
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100163 TensorShape{ 640U, 480U, 2U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100164 TensorShape{ 4160U, 3120U },
165 // Batch size 4
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100166 TensorShape{ 800U, 600U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100167 })
168 {
169 }
170};
171
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100172/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100173class Large2DShapes final : public ShapeDataset
174{
175public:
176 Large2DShapes()
177 : ShapeDataset("Shape",
178 {
179 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100180 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100181 TensorShape{ 4160U, 3120U }
182 })
183 {
184 }
185};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100186
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100187/** Data set containing large 3D tensor shapes. */
188class Large3DShapes final : public ShapeDataset
189{
190public:
191 Large3DShapes()
192 : ShapeDataset("Shape",
193 {
194 TensorShape{ 320U, 240U, 3U },
195 TensorShape{ 383U, 653U, 2U },
196 TensorShape{ 721U, 123U, 13U }
197 })
198 {
199 }
200};
201
202/** Data set containing large 4D tensor shapes. */
203class Large4DShapes final : public ShapeDataset
204{
205public:
206 Large4DShapes()
207 : ShapeDataset("Shape",
208 {
209 TensorShape{ 320U, 123U, 3U, 3U },
210 TensorShape{ 383U, 413U, 2U, 3U },
211 TensorShape{ 517U, 123U, 13U, 2U }
212 })
213 {
214 }
215};
216
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100217/** Data set containing small tensor shapes for deconvolution. */
218class SmallDeconvolutionShapes final : public ShapeDataset
219{
220public:
221 SmallDeconvolutionShapes()
222 : ShapeDataset("InputShape",
223 {
224 TensorShape{ 2U, 3U, 3U, 2U },
225 TensorShape{ 5U, 5U, 3U },
226 TensorShape{ 11U, 13U, 4U, 3U }
227 })
228 {
229 }
230};
231
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100232/** Data set containing small tensor shapes for direct convolution. */
233class SmallDirectConvolutionShapes final : public ShapeDataset
234{
235public:
236 SmallDirectConvolutionShapes()
237 : ShapeDataset("InputShape",
238 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100239 // Batch size 1
steniu01f81652d2017-09-11 15:29:12 +0100240 TensorShape{ 35U, 35U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100241 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100242 // Batch size 4
SiCong Licaf8c5e2017-08-21 13:12:52 +0100243 TensorShape{ 32U, 37U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100244 // Batch size 8
SiCong Licaf8c5e2017-08-21 13:12:52 +0100245 TensorShape{ 32U, 37U, 3U, 8U },
steniu01f81652d2017-09-11 15:29:12 +0100246 TensorShape{ 33U, 35U, 8U, 8U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100247 // Arbitrary batch size
248 TensorShape{ 32U, 37U, 3U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100249 })
250 {
251 }
252};
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100253
254/** Data set containing 2D tensor shapes for DepthConcatenate. */
255class DepthConcatenateShapes final : public ShapeDataset
256{
257public:
258 DepthConcatenateShapes()
259 : ShapeDataset("Shape",
260 {
261 TensorShape{ 322U, 243U },
262 TensorShape{ 463U, 879U },
263 TensorShape{ 416U, 651U }
264 })
265 {
266 }
267};
268
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100269/** Data set containing global pooling tensor shapes. */
270class GlobalPoolingShapes final : public ShapeDataset
271{
272public:
273 GlobalPoolingShapes()
274 : ShapeDataset("Shape",
275 {
276 // Batch size 1
277 TensorShape{ 9U, 9U },
278 TensorShape{ 13U, 13U, 2U },
279 TensorShape{ 27U, 27U, 1U, 3U },
280 // Batch size 4
281 TensorShape{ 31U, 31U, 3U, 4U },
282 TensorShape{ 34U, 34U, 2U, 4U }
283 })
284 {
285 }
286};
287
Chunosovd6afedc2017-11-06 22:09:45 +0700288/** Data set containing small softmax layer shapes. */
289class SoftmaxLayerSmallShapes final : public ShapeDataset
290{
291public:
292 SoftmaxLayerSmallShapes()
293 : ShapeDataset("Shape",
294 {
295 TensorShape{ 9U, 9U },
296 TensorShape{ 256U, 10U, 2U },
297 TensorShape{ 353U, 8U, 2U, 2U },
298 TensorShape{ 512U, 7U, 2U, 2U },
299 TensorShape{ 633U, 10U, 1U, 2U },
300 TensorShape{ 781U, 5U, 2U },
301 })
302 {
303 }
304};
305
306/** Data set containing large softmax layer shapes. */
307class SoftmaxLayerLargeShapes final : public ShapeDataset
308{
309public:
310 SoftmaxLayerLargeShapes()
311 : ShapeDataset("Shape",
312 {
313 TensorShape{ 1000U, 10U },
314 TensorShape{ 3989U, 10U, 2U },
315 TensorShape{ 4098U, 8U, 1U, 2U },
316 TensorShape{ 7339U, 11U },
317 })
318 {
319 }
320};
321
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100322} // namespace datasets
323} // namespace test
324} // namespace arm_compute
325#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */