blob: 806fc04c0d3fe8db677b71fa5509f09c061675d3 [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
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100104 TensorShape{ 7U, 7U },
105 TensorShape{ 27U, 13U, 2U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100106 TensorShape{ 128U, 64U, 1U, 3U },
107 // Batch size 4
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100108 TensorShape{ 7U, 7U, 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
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100111 TensorShape{ 7U, 7U, 3U, 5U }
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100112 })
113 {
114 }
115};
116
117/** Data set containing large tensor shapes. */
118class LargeShapes final : public ShapeDataset
119{
120public:
121 LargeShapes()
122 : ShapeDataset("Shape",
123 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100124 // Batch size 1
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100125 TensorShape{ 1920U, 1080U },
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100126 TensorShape{ 640U, 480U, 2U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100127 TensorShape{ 4160U, 3120U },
128 // Batch size 4
Moritz Pflanzerd1b21f22017-09-01 10:22:47 +0100129 TensorShape{ 800U, 600U, 1U, 4U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100130 })
131 {
132 }
133};
134
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100135/** Data set containing large 2D tensor shapes. */
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100136class Large2DShapes final : public ShapeDataset
137{
138public:
139 Large2DShapes()
140 : ShapeDataset("Shape",
141 {
142 TensorShape{ 1920U, 1080U },
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100143 TensorShape{ 1245U, 652U },
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100144 TensorShape{ 4160U, 3120U }
145 })
146 {
147 }
148};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100149
Gian Marco Iodice06b184a2017-08-29 16:05:25 +0100150/** Data set containing large 3D tensor shapes. */
151class Large3DShapes final : public ShapeDataset
152{
153public:
154 Large3DShapes()
155 : ShapeDataset("Shape",
156 {
157 TensorShape{ 320U, 240U, 3U },
158 TensorShape{ 383U, 653U, 2U },
159 TensorShape{ 721U, 123U, 13U }
160 })
161 {
162 }
163};
164
165/** Data set containing large 4D tensor shapes. */
166class Large4DShapes final : public ShapeDataset
167{
168public:
169 Large4DShapes()
170 : ShapeDataset("Shape",
171 {
172 TensorShape{ 320U, 123U, 3U, 3U },
173 TensorShape{ 383U, 413U, 2U, 3U },
174 TensorShape{ 517U, 123U, 13U, 2U }
175 })
176 {
177 }
178};
179
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100180/** Data set containing small tensor shapes for direct convolution. */
181class SmallDirectConvolutionShapes final : public ShapeDataset
182{
183public:
184 SmallDirectConvolutionShapes()
185 : ShapeDataset("InputShape",
186 {
SiCong Licaf8c5e2017-08-21 13:12:52 +0100187 // Batch size 1
188 TensorShape{ 5U, 5U, 3U },
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100189 TensorShape{ 32U, 37U, 3U },
SiCong Licaf8c5e2017-08-21 13:12:52 +0100190 TensorShape{ 13U, 15U, 8U },
191 // Batch size 4
192 TensorShape{ 5U, 5U, 3U, 4U },
193 TensorShape{ 32U, 37U, 3U, 4U },
194 TensorShape{ 13U, 15U, 8U, 4U },
195 // Batch size 8
196 TensorShape{ 5U, 5U, 3U, 8U },
197 TensorShape{ 32U, 37U, 3U, 8U },
198 TensorShape{ 13U, 15U, 8U, 8U },
199 // Arbitrary batch size
200 TensorShape{ 32U, 37U, 3U, 8U }
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100201 })
202 {
203 }
204};
Moritz Pflanzerf6ad98a2017-07-21 17:19:58 +0100205} // namespace datasets
206} // namespace test
207} // namespace arm_compute
208#endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */