Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 1 | /* |
| 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 Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 28 | #include "tests/framework/datasets/Datasets.h" |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 29 | |
| 30 | #include <type_traits> |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | namespace test |
| 35 | { |
| 36 | namespace datasets |
| 37 | { |
Gian Marco | 5420b28 | 2017-11-29 10:41:38 +0000 | [diff] [blame] | 38 | /** Parent type for all for shape datasets. */ |
| 39 | using ShapeDataset = framework::dataset::ContainerDataset<std::vector<TensorShape>>; |
| 40 | |
| 41 | /** Data set containing small 1D tensor shapes. */ |
| 42 | class Small1DShapes final : public ShapeDataset |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 43 | { |
| 44 | public: |
Gian Marco | 5420b28 | 2017-11-29 10:41:38 +0000 | [diff] [blame] | 45 | Small1DShapes() |
| 46 | : ShapeDataset("Shape", |
| 47 | { |
| 48 | TensorShape{ 256U } |
| 49 | }) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 50 | { |
| 51 | } |
| 52 | }; |
| 53 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 54 | /** Data set containing small 2D tensor shapes. */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 55 | class Small2DShapes final : public ShapeDataset |
| 56 | { |
| 57 | public: |
| 58 | Small2DShapes() |
| 59 | : ShapeDataset("Shape", |
| 60 | { |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 61 | TensorShape{ 7U, 7U }, |
| 62 | TensorShape{ 27U, 13U }, |
| 63 | TensorShape{ 128U, 64U } |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 64 | }) |
| 65 | { |
| 66 | } |
| 67 | }; |
| 68 | |
Gian Marco Iodice | 06b184a | 2017-08-29 16:05:25 +0100 | [diff] [blame] | 69 | /** Data set containing small 3D tensor shapes. */ |
| 70 | class Small3DShapes final : public ShapeDataset |
| 71 | { |
| 72 | public: |
| 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. */ |
| 85 | class Small4DShapes final : public ShapeDataset |
| 86 | { |
| 87 | public: |
| 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 Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 99 | /** Data set containing small tensor shapes. */ |
| 100 | class SmallShapes final : public ShapeDataset |
| 101 | { |
| 102 | public: |
| 103 | SmallShapes() |
| 104 | : ShapeDataset("Shape", |
| 105 | { |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 106 | // Batch size 1 |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 107 | TensorShape{ 9U, 9U }, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 108 | TensorShape{ 27U, 13U, 2U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 109 | TensorShape{ 128U, 64U, 1U, 3U }, |
| 110 | // Batch size 4 |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 111 | TensorShape{ 9U, 9U, 3U, 4U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 112 | TensorShape{ 27U, 13U, 2U, 4U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 113 | // Arbitrary batch size |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 114 | TensorShape{ 9U, 9U, 3U, 5U } |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 115 | }) |
| 116 | { |
| 117 | } |
| 118 | }; |
| 119 | |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 120 | /** Data set containing medium tensor shapes. */ |
| 121 | class MediumShapes final : public ShapeDataset |
| 122 | { |
| 123 | public: |
| 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 Marco | 37908d9 | 2017-11-07 14:38:22 +0000 | [diff] [blame] | 141 | /** Data set containing medium 2D tensor shapes. */ |
| 142 | class Medium2DShapes final : public ShapeDataset |
| 143 | { |
| 144 | public: |
| 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 Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 157 | /** Data set containing large tensor shapes. */ |
| 158 | class LargeShapes final : public ShapeDataset |
| 159 | { |
| 160 | public: |
| 161 | LargeShapes() |
| 162 | : ShapeDataset("Shape", |
| 163 | { |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 164 | // Batch size 1 |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame^] | 165 | TensorShape{ 1921U, 1083U }, |
| 166 | TensorShape{ 641U, 485U, 2U, 3U }, |
| 167 | TensorShape{ 4159U, 3117U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 168 | // Batch size 4 |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame^] | 169 | TensorShape{ 799U, 595U, 1U, 4U }, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 170 | }) |
| 171 | { |
| 172 | } |
| 173 | }; |
| 174 | |
Gian Marco | 5420b28 | 2017-11-29 10:41:38 +0000 | [diff] [blame] | 175 | /** Data set containing large 1D tensor shapes. */ |
| 176 | class Large1DShapes final : public ShapeDataset |
| 177 | { |
| 178 | public: |
| 179 | Large1DShapes() |
| 180 | : ShapeDataset("Shape", |
| 181 | { |
| 182 | TensorShape{ 1921U }, |
| 183 | TensorShape{ 1245U }, |
| 184 | TensorShape{ 4160U } |
| 185 | }) |
| 186 | { |
| 187 | } |
| 188 | }; |
| 189 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 190 | /** Data set containing large 2D tensor shapes. */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 191 | class Large2DShapes final : public ShapeDataset |
| 192 | { |
| 193 | public: |
| 194 | Large2DShapes() |
| 195 | : ShapeDataset("Shape", |
| 196 | { |
| 197 | TensorShape{ 1920U, 1080U }, |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 198 | TensorShape{ 1245U, 652U }, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 199 | TensorShape{ 4160U, 3120U } |
| 200 | }) |
| 201 | { |
| 202 | } |
| 203 | }; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 204 | |
Gian Marco Iodice | 06b184a | 2017-08-29 16:05:25 +0100 | [diff] [blame] | 205 | /** Data set containing large 3D tensor shapes. */ |
| 206 | class Large3DShapes final : public ShapeDataset |
| 207 | { |
| 208 | public: |
| 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. */ |
| 221 | class Large4DShapes final : public ShapeDataset |
| 222 | { |
| 223 | public: |
| 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 Tello | f5f34bb | 2017-08-22 13:34:13 +0100 | [diff] [blame] | 235 | /** Data set containing small tensor shapes for deconvolution. */ |
| 236 | class SmallDeconvolutionShapes final : public ShapeDataset |
| 237 | { |
| 238 | public: |
| 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 Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 250 | /** Data set containing small tensor shapes for direct convolution. */ |
| 251 | class SmallDirectConvolutionShapes final : public ShapeDataset |
| 252 | { |
| 253 | public: |
| 254 | SmallDirectConvolutionShapes() |
| 255 | : ShapeDataset("InputShape", |
| 256 | { |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 257 | // Batch size 1 |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 258 | TensorShape{ 35U, 35U, 3U }, |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 259 | TensorShape{ 32U, 37U, 3U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 260 | // Batch size 4 |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 261 | TensorShape{ 32U, 37U, 3U, 4U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 262 | // Batch size 8 |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 263 | TensorShape{ 32U, 37U, 3U, 8U }, |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 264 | TensorShape{ 33U, 35U, 8U, 8U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 265 | // Arbitrary batch size |
| 266 | TensorShape{ 32U, 37U, 3U, 8U } |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 267 | }) |
| 268 | { |
| 269 | } |
| 270 | }; |
Gian Marco Iodice | b2833b8 | 2017-09-13 16:23:18 +0100 | [diff] [blame] | 271 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 272 | /** Data set containing 2D tensor shapes for DepthConcatenateLayer. */ |
| 273 | class DepthConcatenateLayerShapes final : public ShapeDataset |
Gian Marco Iodice | b2833b8 | 2017-09-13 16:23:18 +0100 | [diff] [blame] | 274 | { |
| 275 | public: |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 276 | DepthConcatenateLayerShapes() |
Gian Marco Iodice | b2833b8 | 2017-09-13 16:23:18 +0100 | [diff] [blame] | 277 | : ShapeDataset("Shape", |
| 278 | { |
| 279 | TensorShape{ 322U, 243U }, |
| 280 | TensorShape{ 463U, 879U }, |
| 281 | TensorShape{ 416U, 651U } |
| 282 | }) |
| 283 | { |
| 284 | } |
| 285 | }; |
| 286 | |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 287 | /** Data set containing global pooling tensor shapes. */ |
| 288 | class GlobalPoolingShapes final : public ShapeDataset |
| 289 | { |
| 290 | public: |
| 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 | |
Chunosov | d6afedc | 2017-11-06 22:09:45 +0700 | [diff] [blame] | 306 | /** Data set containing small softmax layer shapes. */ |
| 307 | class SoftmaxLayerSmallShapes final : public ShapeDataset |
| 308 | { |
| 309 | public: |
| 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. */ |
| 325 | class SoftmaxLayerLargeShapes final : public ShapeDataset |
| 326 | { |
| 327 | public: |
| 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 Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 340 | } // namespace datasets |
| 341 | } // namespace test |
| 342 | } // namespace arm_compute |
| 343 | #endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */ |