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 | { |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 38 | /** Data set containing 1D tensor shapes. */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 39 | class Small1DShape final : public framework::dataset::SingletonDataset<TensorShape> |
| 40 | { |
| 41 | public: |
| 42 | Small1DShape() |
| 43 | : SingletonDataset("Shape", TensorShape{ 256U }) |
| 44 | { |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | /** Parent type for all for shape datasets. */ |
| 49 | using ShapeDataset = framework::dataset::ContainerDataset<std::vector<TensorShape>>; |
| 50 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 51 | /** Data set containing small 2D tensor shapes. */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 52 | class Small2DShapes final : public ShapeDataset |
| 53 | { |
| 54 | public: |
| 55 | Small2DShapes() |
| 56 | : ShapeDataset("Shape", |
| 57 | { |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 58 | TensorShape{ 7U, 7U }, |
| 59 | TensorShape{ 27U, 13U }, |
| 60 | TensorShape{ 128U, 64U } |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 61 | }) |
| 62 | { |
| 63 | } |
| 64 | }; |
| 65 | |
Gian Marco Iodice | 06b184a | 2017-08-29 16:05:25 +0100 | [diff] [blame] | 66 | /** Data set containing small 3D tensor shapes. */ |
| 67 | class Small3DShapes final : public ShapeDataset |
| 68 | { |
| 69 | public: |
| 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. */ |
| 82 | class Small4DShapes final : public ShapeDataset |
| 83 | { |
| 84 | public: |
| 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 Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 96 | /** Data set containing small tensor shapes. */ |
| 97 | class SmallShapes final : public ShapeDataset |
| 98 | { |
| 99 | public: |
| 100 | SmallShapes() |
| 101 | : ShapeDataset("Shape", |
| 102 | { |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 103 | // Batch size 1 |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 104 | TensorShape{ 9U, 9U }, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 105 | TensorShape{ 27U, 13U, 2U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 106 | TensorShape{ 128U, 64U, 1U, 3U }, |
| 107 | // Batch size 4 |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 108 | TensorShape{ 9U, 9U, 3U, 4U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 109 | TensorShape{ 27U, 13U, 2U, 4U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 110 | // Arbitrary batch size |
Gian Marco Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 111 | TensorShape{ 9U, 9U, 3U, 5U } |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 112 | }) |
| 113 | { |
| 114 | } |
| 115 | }; |
| 116 | |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 117 | /** Data set containing medium tensor shapes. */ |
| 118 | class MediumShapes final : public ShapeDataset |
| 119 | { |
| 120 | public: |
| 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 Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 138 | /** Data set containing large tensor shapes. */ |
| 139 | class LargeShapes final : public ShapeDataset |
| 140 | { |
| 141 | public: |
| 142 | LargeShapes() |
| 143 | : ShapeDataset("Shape", |
| 144 | { |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 145 | // Batch size 1 |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 146 | TensorShape{ 1920U, 1080U }, |
Moritz Pflanzer | d1b21f2 | 2017-09-01 10:22:47 +0100 | [diff] [blame] | 147 | TensorShape{ 640U, 480U, 2U, 3U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 148 | TensorShape{ 4160U, 3120U }, |
| 149 | // Batch size 4 |
Moritz Pflanzer | d1b21f2 | 2017-09-01 10:22:47 +0100 | [diff] [blame] | 150 | TensorShape{ 800U, 600U, 1U, 4U }, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 151 | }) |
| 152 | { |
| 153 | } |
| 154 | }; |
| 155 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 156 | /** Data set containing large 2D tensor shapes. */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 157 | class Large2DShapes final : public ShapeDataset |
| 158 | { |
| 159 | public: |
| 160 | Large2DShapes() |
| 161 | : ShapeDataset("Shape", |
| 162 | { |
| 163 | TensorShape{ 1920U, 1080U }, |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 164 | TensorShape{ 1245U, 652U }, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 165 | TensorShape{ 4160U, 3120U } |
| 166 | }) |
| 167 | { |
| 168 | } |
| 169 | }; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 170 | |
Gian Marco Iodice | 06b184a | 2017-08-29 16:05:25 +0100 | [diff] [blame] | 171 | /** Data set containing large 3D tensor shapes. */ |
| 172 | class Large3DShapes final : public ShapeDataset |
| 173 | { |
| 174 | public: |
| 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. */ |
| 187 | class Large4DShapes final : public ShapeDataset |
| 188 | { |
| 189 | public: |
| 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 Tello | f5f34bb | 2017-08-22 13:34:13 +0100 | [diff] [blame^] | 201 | /** Data set containing small tensor shapes for deconvolution. */ |
| 202 | class SmallDeconvolutionShapes final : public ShapeDataset |
| 203 | { |
| 204 | public: |
| 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 Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 216 | /** Data set containing small tensor shapes for direct convolution. */ |
| 217 | class SmallDirectConvolutionShapes final : public ShapeDataset |
| 218 | { |
| 219 | public: |
| 220 | SmallDirectConvolutionShapes() |
| 221 | : ShapeDataset("InputShape", |
| 222 | { |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 223 | // Batch size 1 |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 224 | TensorShape{ 35U, 35U, 3U }, |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 225 | TensorShape{ 32U, 37U, 3U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 226 | // Batch size 4 |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 227 | TensorShape{ 32U, 37U, 3U, 4U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 228 | // Batch size 8 |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 229 | TensorShape{ 32U, 37U, 3U, 8U }, |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 230 | TensorShape{ 33U, 35U, 8U, 8U }, |
SiCong Li | caf8c5e | 2017-08-21 13:12:52 +0100 | [diff] [blame] | 231 | // Arbitrary batch size |
| 232 | TensorShape{ 32U, 37U, 3U, 8U } |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 233 | }) |
| 234 | { |
| 235 | } |
| 236 | }; |
Gian Marco Iodice | b2833b8 | 2017-09-13 16:23:18 +0100 | [diff] [blame] | 237 | |
| 238 | /** Data set containing 2D tensor shapes for DepthConcatenate. */ |
| 239 | class DepthConcatenateShapes final : public ShapeDataset |
| 240 | { |
| 241 | public: |
| 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 Iodice | bf17955 | 2017-09-05 13:51:21 +0100 | [diff] [blame] | 253 | /** Data set containing global pooling tensor shapes. */ |
| 254 | class GlobalPoolingShapes final : public ShapeDataset |
| 255 | { |
| 256 | public: |
| 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 Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 272 | } // namespace datasets |
| 273 | } // namespace test |
| 274 | } // namespace arm_compute |
| 275 | #endif /* __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ */ |