blob: 86ed2b2ad7fdb9bbe08ceb1b8f1f1afb3c65b2c0 [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
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100138/** Data set containing large tensor shapes. */
139class LargeShapes final : public ShapeDataset
140{
141public:
142 LargeShapes()
143 : ShapeDataset("Shape",
144 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100145 // Batch size 1
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100146 TensorShape{ 1920U, 1080U },
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100147 TensorShape{ 640U, 480U, 2U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100148 TensorShape{ 4160U, 3120U },
149 // Batch size 4
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100150 TensorShape{ 800U, 600U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100151 })
152 {
153 }
154};
155
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100156/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100157class Large2DShapes final : public ShapeDataset
158{
159public:
160 Large2DShapes()
161 : ShapeDataset("Shape",
162 {
163 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100164 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100165 TensorShape{ 4160U, 3120U }
166 })
167 {
168 }
169};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100170
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100171/** Data set containing large 3D tensor shapes. */
172class Large3DShapes final : public ShapeDataset
173{
174public:
175 Large3DShapes()
176 : ShapeDataset("Shape",
177 {
178 TensorShape{ 320U, 240U, 3U },
179 TensorShape{ 383U, 653U, 2U },
180 TensorShape{ 721U, 123U, 13U }
181 })
182 {
183 }
184};
185
186/** Data set containing large 4D tensor shapes. */
187class Large4DShapes final : public ShapeDataset
188{
189public:
190 Large4DShapes()
191 : ShapeDataset("Shape",
192 {
193 TensorShape{ 320U, 123U, 3U, 3U },
194 TensorShape{ 383U, 413U, 2U, 3U },
195 TensorShape{ 517U, 123U, 13U, 2U }
196 })
197 {
198 }
199};
200
Pablo Tellof5f34bb2017-08-22 13:34:13 +0100201/** Data set containing small tensor shapes for deconvolution. */
202class SmallDeconvolutionShapes final : public ShapeDataset
203{
204public:
205 SmallDeconvolutionShapes()
206 : ShapeDataset("InputShape",
207 {
208 TensorShape{ 2U, 3U, 3U, 2U },
209 TensorShape{ 5U, 5U, 3U },
210 TensorShape{ 11U, 13U, 4U, 3U }
211 })
212 {
213 }
214};
215
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100216/** Data set containing small tensor shapes for direct convolution. */
217class SmallDirectConvolutionShapes final : public ShapeDataset
218{
219public:
220 SmallDirectConvolutionShapes()
221 : ShapeDataset("InputShape",
222 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100223 // Batch size 1
steniu01f81652d2017-09-11 15:29:12 +0100224 TensorShape{ 35U, 35U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100225 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100226 // Batch size 4
SiCong Licaf8c5e2017-08-21 13:12:52 +0100227 TensorShape{ 32U, 37U, 3U, 4U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100228 // Batch size 8
SiCong Licaf8c5e2017-08-21 13:12:52 +0100229 TensorShape{ 32U, 37U, 3U, 8U },
steniu01f81652d2017-09-11 15:29:12 +0100230 TensorShape{ 33U, 35U, 8U, 8U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100231 // Arbitrary batch size
232 TensorShape{ 32U, 37U, 3U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100233 })
234 {
235 }
236};
Gian Marco Iodiceb2833b82017-09-13 16:23:18 +0100237
238/** Data set containing 2D tensor shapes for DepthConcatenate. */
239class DepthConcatenateShapes final : public ShapeDataset
240{
241public:
242 DepthConcatenateShapes()
243 : ShapeDataset("Shape",
244 {
245 TensorShape{ 322U, 243U },
246 TensorShape{ 463U, 879U },
247 TensorShape{ 416U, 651U }
248 })
249 {
250 }
251};
252
Gian Marco Iodicebf179552017-09-05 13:51:21 +0100253/** Data set containing global pooling tensor shapes. */
254class GlobalPoolingShapes final : public ShapeDataset
255{
256public:
257 GlobalPoolingShapes()
258 : ShapeDataset("Shape",
259 {
260 // Batch size 1
261 TensorShape{ 9U, 9U },
262 TensorShape{ 13U, 13U, 2U },
263 TensorShape{ 27U, 27U, 1U, 3U },
264 // Batch size 4
265 TensorShape{ 31U, 31U, 3U, 4U },
266 TensorShape{ 34U, 34U, 2U, 4U }
267 })
268 {
269 }
270};
271
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100272} // namespace datasets
273} // namespace test
274} // namespace arm_compute
275#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */