blob: 66640dd943fa515c1fe0c0a6a23633d6cb4afe9f [file] [log] [blame]
Moritz Pflanzerb3d25792017-07-26 11:49:37 +01001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2017-2020 Arm Limited.
Moritz Pflanzerb3d25792017-07-26 11:49:37 +01003 *
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_SMALL_CONVOLUTION_LAYER_DATASET
25#define ARM_COMPUTE_TEST_SMALL_CONVOLUTION_LAYER_DATASET
26
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010027#include "tests/datasets/ConvolutionLayerDataset.h"
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010028
Anthony Barbier2a07e182017-08-04 18:20:27 +010029#include "utils/TypePrinter.h"
Moritz Pflanzerb3d25792017-07-26 11:49:37 +010030
31#include "arm_compute/core/TensorShape.h"
32#include "arm_compute/core/Types.h"
33
34namespace arm_compute
35{
36namespace test
37{
38namespace datasets
39{
Gian Marco Iodiced2fab732018-03-02 11:18:12 +000040class SmallWinogradConvolutionLayer3x3Dataset final : public ConvolutionLayerDataset
Pablo Tello89519332017-11-17 11:52:36 +000041{
42public:
Gian Marco Iodiced2fab732018-03-02 11:18:12 +000043 SmallWinogradConvolutionLayer3x3Dataset()
Pablo Tello89519332017-11-17 11:52:36 +000044 {
Pablo Tello79ffade2018-05-04 11:45:13 +010045 // Channel size big enough to force multithreaded execution of the input transform
46 add_config(TensorShape(8U, 8U, 32U), TensorShape(3U, 3U, 32U, 1U), TensorShape(1U), TensorShape(6U, 6U, 1U), PadStrideInfo(1, 1, 0, 0));
Pablo Tello89519332017-11-17 11:52:36 +000047 // Batch size 1
48 add_config(TensorShape(8U, 8U, 2U), TensorShape(3U, 3U, 2U, 1U), TensorShape(1U), TensorShape(6U, 6U, 1U), PadStrideInfo(1, 1, 0, 0));
49 // Batch size 4
50 add_config(TensorShape(23U, 27U, 5U, 4U), TensorShape(3U, 3U, 5U, 21U), TensorShape(21U), TensorShape(21U, 25U, 21U, 4U), PadStrideInfo(1, 1, 0, 0));
Pablo Tello679463a2018-02-06 11:47:59 +000051 add_config(TensorShape(8U, 8U, 2U), TensorShape(3U, 3U, 2U, 1U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 1, 1));
giuros01f44fe3d2019-08-14 16:49:27 +010052 add_config(TensorShape(3U, 9U), TensorShape(3U, 3U), TensorShape(1), TensorShape(3U, 9U), PadStrideInfo(1, 1, 1, 1));
Gian Marco Iodiced2fab732018-03-02 11:18:12 +000053 }
54};
Pablo Tellof6c572c2018-02-14 12:47:30 +000055
Gian Marco Iodicef1c2bf02018-06-13 14:05:54 +010056class SmallWinogradConvolutionLayer3x1Dataset final : public ConvolutionLayerDataset
57{
58public:
59 SmallWinogradConvolutionLayer3x1Dataset()
60 {
61 // Channel size big enough to force multithreaded execution of the input transform
62 add_config(TensorShape(8U, 8U, 32U), TensorShape(3U, 1U, 32U, 1U), TensorShape(1U), TensorShape(6U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
63 // Batch size 1
64 add_config(TensorShape(8U, 8U, 2U), TensorShape(3U, 1U, 2U, 1U), TensorShape(1U), TensorShape(6U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
65 // Batch size 4
66 add_config(TensorShape(23U, 27U, 5U, 4U), TensorShape(3U, 1U, 5U, 21U), TensorShape(21U), TensorShape(21U, 27U, 21U, 4U), PadStrideInfo(1, 1, 0, 0));
67 add_config(TensorShape(8U, 8U, 2U), TensorShape(3U, 1U, 2U, 1U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 1, 0));
68 }
69};
70
71class SmallWinogradConvolutionLayer1x3Dataset final : public ConvolutionLayerDataset
72{
73public:
74 SmallWinogradConvolutionLayer1x3Dataset()
75 {
76 // Channel size big enough to force multithreaded execution of the input transform
77 add_config(TensorShape(8U, 8U, 32U), TensorShape(1U, 3U, 32U, 1U), TensorShape(1U), TensorShape(8U, 6U, 1U), PadStrideInfo(1, 1, 0, 0));
78 // Batch size 1
79 add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 3U, 2U, 1U), TensorShape(1U), TensorShape(8U, 6U, 1U), PadStrideInfo(1, 1, 0, 0));
80 // Batch size 4
81 add_config(TensorShape(23U, 27U, 5U, 4U), TensorShape(1U, 3U, 5U, 21U), TensorShape(21U), TensorShape(23U, 25U, 21U, 4U), PadStrideInfo(1, 1, 0, 0));
82 add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 3U, 2U, 1U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 0, 1));
83 }
84};
85
Gian Marco Iodiced2fab732018-03-02 11:18:12 +000086class SmallWinogradConvolutionLayer5x5Dataset final : public ConvolutionLayerDataset
87{
88public:
89 SmallWinogradConvolutionLayer5x5Dataset()
90 {
Pablo Tellof6c572c2018-02-14 12:47:30 +000091 add_config(TensorShape(8U, 8U, 2U), TensorShape(5U, 5U, 2U, 1U), TensorShape(1U), TensorShape(4U, 4U, 1U), PadStrideInfo(1, 1, 0, 0));
Pablo Tellod267b052018-02-19 16:46:03 +000092 add_config(TensorShape(8U, 8U, 2U), TensorShape(5U, 5U, 2U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 2, 2));
Pablo Tello89519332017-11-17 11:52:36 +000093 }
94};
95
Gian Marco Iodice876be2a2018-07-03 12:22:09 +010096class SmallWinogradConvolutionLayer5x1Dataset final : public ConvolutionLayerDataset
97{
98public:
99 SmallWinogradConvolutionLayer5x1Dataset()
100 {
101 add_config(TensorShape(8U, 8U, 2U), TensorShape(5U, 1U, 2U, 1U), TensorShape(1U), TensorShape(4U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
102 add_config(TensorShape(8U, 8U, 2U), TensorShape(5U, 1U, 2U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 2, 0));
103 }
104};
105
106class SmallWinogradConvolutionLayer1x5Dataset final : public ConvolutionLayerDataset
107{
108public:
109 SmallWinogradConvolutionLayer1x5Dataset()
110 {
111 add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 5U, 2U, 1U), TensorShape(1U), TensorShape(8U, 4U, 1U), PadStrideInfo(1, 1, 0, 0));
112 add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 5U, 2U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 0, 2));
113 }
114};
115
Pablo Tello96e922e2018-09-26 11:25:15 +0100116class SmallWinogradConvolutionLayer7x1Dataset final : public ConvolutionLayerDataset
117{
118public:
119 SmallWinogradConvolutionLayer7x1Dataset()
120 {
121 add_config(TensorShape(14U, 14U, 2U), TensorShape(7U, 1U, 2U, 1U), TensorShape(1U), TensorShape(8U, 14U, 1U), PadStrideInfo(1, 1, 0, 0));
122 add_config(TensorShape(14U, 14U, 2U), TensorShape(7U, 1U, 2U), TensorShape(1U), TensorShape(14U, 14U, 1U), PadStrideInfo(1, 1, 3, 0));
123 }
124};
125
126class SmallWinogradConvolutionLayer1x7Dataset final : public ConvolutionLayerDataset
127{
128public:
129 SmallWinogradConvolutionLayer1x7Dataset()
130 {
131 add_config(TensorShape(14U, 14U, 2U), TensorShape(1U, 7U, 2U, 1U), TensorShape(1U), TensorShape(14U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
132 add_config(TensorShape(14U, 14U, 2U), TensorShape(1U, 7U, 2U), TensorShape(1U), TensorShape(14U, 14U, 1U), PadStrideInfo(1, 1, 0, 3));
133 }
134};
135
Georgios Pinitas8be91482019-03-26 17:23:28 +0000136class SmallFFTConvolutionLayerDataset final : public ConvolutionLayerDataset
137{
138public:
139 SmallFFTConvolutionLayerDataset()
140 {
141 add_config(TensorShape(8U, 7U, 3U), TensorShape(3U, 3U, 3U, 2U), TensorShape(2U), TensorShape(8U, 7U, 2U), PadStrideInfo(1, 1, 1, 1));
142 add_config(TensorShape(64U, 32U, 5U), TensorShape(5U, 5U, 5U, 10U), TensorShape(10U), TensorShape(64U, 32U, 10U), PadStrideInfo(1, 1, 2, 2));
143 add_config(TensorShape(192U, 128U, 8U), TensorShape(9U, 9U, 8U, 3U), TensorShape(3U), TensorShape(192U, 128U, 3U), PadStrideInfo(1, 1, 4, 4));
144 }
145};
146
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100147class SmallConvolutionLayerDataset final : public ConvolutionLayerDataset
148{
149public:
150 SmallConvolutionLayerDataset()
151 {
Georgios Pinitas0e7210d2018-12-12 19:14:27 +0000152 // 1D Kernel
153 add_config(TensorShape(1U, 5U, 2U), TensorShape(1U, 3U, 2U, 3U), TensorShape(3U), TensorShape(1U, 7U, 3U), PadStrideInfo(1, 1, 0, 0, 2, 2, DimensionRoundingType::FLOOR));
154
Michele Di Giorgioe37662a2020-04-29 15:14:18 +0100155 // 1x1 Kernel with Stride (1, 1) and NHWC data layout in order to test skipping Im2Col
156 add_config(TensorShape(1U, 5U, 2U), TensorShape(1U, 1U, 2U, 3U), TensorShape(3U), TensorShape(1U, 5U, 3U), PadStrideInfo(1, 1, 0, 0));
157
SiCong Licaf8c5e2017-08-21 13:12:52 +0100158 // Batch size 1
Michele Di Giorgioe37662a2020-04-29 15:14:18 +0100159 add_config(TensorShape(23U, 27U, 5U), TensorShape(3U, 3U, 5U, 2U), TensorShape(2U), TensorShape(11U, 25U, 2U), PadStrideInfo(2, 1, 0, 0));
160 add_config(TensorShape(33U, 27U, 7U), TensorShape(5U, 5U, 7U, 3U), TensorShape(3U), TensorShape(11U, 12U, 3U), PadStrideInfo(3, 2, 1, 0));
161 add_config(TensorShape(17U, 31U, 2U), TensorShape(5U, 5U, 2U, 4U), TensorShape(4U), TensorShape(15U, 15U, 4U), PadStrideInfo(1, 2, 1, 1));
162 add_config(TensorShape(3U, 3U, 1U), TensorShape(2U, 2U, 1U, 5U), TensorShape(5U), TensorShape(2U, 2U, 5U), PadStrideInfo(1, 1, 0, 0));
163
164 // Batch size different than one
SiCong Licaf8c5e2017-08-21 13:12:52 +0100165 add_config(TensorShape(23U, 27U, 5U, 4U), TensorShape(3U, 3U, 5U, 21U), TensorShape(21U), TensorShape(11U, 25U, 21U, 4U), PadStrideInfo(2, 1, 0, 0));
166 add_config(TensorShape(33U, 27U, 7U, 4U), TensorShape(5U, 5U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 4U), PadStrideInfo(3, 2, 1, 0));
167 add_config(TensorShape(17U, 31U, 2U, 4U), TensorShape(5U, 5U, 2U, 19U), TensorShape(19U), TensorShape(15U, 15U, 19U, 4U), PadStrideInfo(1, 2, 1, 1));
Michele Di Giorgioe37662a2020-04-29 15:14:18 +0100168
Georgios Pinitasb660dcf2017-12-13 10:48:06 +0000169 // FC convolution
170 add_config(TensorShape(1U, 1U, 1024U), TensorShape(1U, 1U, 1024U, 1001U), TensorShape(1001U), TensorShape(1U, 1U, 1001U), PadStrideInfo(1, 1, 0, 0));
Michele Di Giorgioe37662a2020-04-29 15:14:18 +0100171
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +0100172 // Asymmetric padding
Michele Di Giorgioe37662a2020-04-29 15:14:18 +0100173 add_config(TensorShape(33U, 27U, 3U), TensorShape(5U, 7U, 3U, 4U), TensorShape(4U), TensorShape(11U, 12U, 4U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR));
174 add_config(TensorShape(33U, 27U, 3U), TensorShape(5U, 7U, 3U, 4U), TensorShape(4U), TensorShape(11U, 12U, 4U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR));
175 add_config(TensorShape(33U, 27U, 3U), TensorShape(5U, 7U, 3U, 4U), TensorShape(4U), TensorShape(11U, 12U, 4U), PadStrideInfo(3, 2, 2, 1, 2, 0, DimensionRoundingType::FLOOR));
176 add_config(TensorShape(33U, 27U, 3U), TensorShape(5U, 7U, 3U, 4U), TensorShape(4U), TensorShape(11U, 12U, 4U), PadStrideInfo(3, 2, 1, 3, 0, 2, DimensionRoundingType::FLOOR));
177 add_config(TensorShape(33U, 27U, 3U), TensorShape(5U, 7U, 3U, 4U), TensorShape(4U), TensorShape(10U, 11U, 4U), PadStrideInfo(3, 2, 1, 0, 1, 0, DimensionRoundingType::FLOOR));
178 add_config(TensorShape(33U, 27U, 3U), TensorShape(5U, 7U, 3U, 4U), TensorShape(4U), TensorShape(10U, 11U, 4U), PadStrideInfo(3, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR));
Gian Marco Iodice3139f032018-11-05 14:26:32 +0000179
180 add_config(TensorShape(5U, 4U, 3U, 2U), TensorShape(4U, 4U, 3U, 1U), TensorShape(1U), TensorShape(2U, 1U, 1U, 2U), PadStrideInfo(1, 1, 0, 0, 0, 0, DimensionRoundingType::FLOOR));
181 }
182};
183
184// TODO (COMPMID-1749)
185class SmallConvolutionLayerReducedDataset final : public ConvolutionLayerDataset
186{
187public:
188 SmallConvolutionLayerReducedDataset()
189 {
190 // Batch size 1
191 add_config(TensorShape(23U, 27U, 5U), TensorShape(3U, 3U, 5U, 21U), TensorShape(21U), TensorShape(11U, 25U, 21U), PadStrideInfo(2, 1, 0, 0));
192 add_config(TensorShape(33U, 27U, 7U), TensorShape(5U, 5U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U), PadStrideInfo(3, 2, 1, 0));
193 add_config(TensorShape(17U, 31U, 2U), TensorShape(5U, 5U, 2U, 19U), TensorShape(19U), TensorShape(15U, 15U, 19U), PadStrideInfo(1, 2, 1, 1));
194
195 // Asymmetric padding
196 add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR));
197 add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR));
198 add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 2, 1, 2, 0, DimensionRoundingType::FLOOR));
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100199 }
200};
Gian Marco Iodice916d1bc2018-08-13 11:20:41 +0100201
202class SmallGroupedConvolutionLayerDataset final : public ConvolutionLayerDataset
203{
204public:
205 SmallGroupedConvolutionLayerDataset()
206 {
207 // Batch size 1
208 // Number of groups = 2
209 add_config(TensorShape(23U, 27U, 8U), TensorShape(1U, 1U, 4U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U), PadStrideInfo(2, 1, 0, 0));
210 add_config(TensorShape(33U, 27U, 12U), TensorShape(5U, 5U, 6U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U), PadStrideInfo(3, 2, 1, 0));
211 // Number of groups = 4
212 add_config(TensorShape(23U, 27U, 8U), TensorShape(1U, 1U, 2U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U), PadStrideInfo(2, 1, 0, 0));
213 add_config(TensorShape(33U, 27U, 12U), TensorShape(5U, 5U, 4U, 15U), TensorShape(15U), TensorShape(11U, 12U, 15U), PadStrideInfo(3, 2, 1, 0));
214
215 // Batch size 4
216 // Number of groups = 2
217 add_config(TensorShape(23U, 27U, 8U, 4U), TensorShape(1U, 1U, 4U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 4U), PadStrideInfo(2, 1, 0, 0));
218 add_config(TensorShape(33U, 27U, 12U, 4U), TensorShape(5U, 5U, 6U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 4U), PadStrideInfo(3, 2, 1, 0));
219 // Number of groups = 4
220 add_config(TensorShape(23U, 27U, 8U, 4U), TensorShape(1U, 1U, 2U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 4U), PadStrideInfo(2, 1, 0, 0));
221 add_config(TensorShape(33U, 27U, 12U, 4U), TensorShape(5U, 5U, 4U, 15U), TensorShape(15U), TensorShape(11U, 12U, 15U, 4U), PadStrideInfo(3, 2, 1, 0));
222
223 // Arbitrary batch size
224 add_config(TensorShape(23U, 27U, 8U, 5U), TensorShape(1U, 1U, 4U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 5U), PadStrideInfo(2, 1, 0, 0));
225 add_config(TensorShape(33U, 27U, 12U, 3U), TensorShape(5U, 5U, 6U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 3U), PadStrideInfo(3, 2, 1, 0));
226 // Number of groups = 4
227 add_config(TensorShape(23U, 27U, 8U, 2U), TensorShape(1U, 1U, 2U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 2U), PadStrideInfo(2, 1, 0, 0));
228 add_config(TensorShape(33U, 27U, 12U, 5U), TensorShape(5U, 5U, 4U, 15U), TensorShape(15U), TensorShape(11U, 12U, 15U, 5U), PadStrideInfo(3, 2, 1, 0));
229
230 // Asymmetric padding
231 add_config(TensorShape(33U, 27U, 8U, 5U), TensorShape(5U, 7U, 2U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR));
232 add_config(TensorShape(33U, 27U, 8U, 5U), TensorShape(5U, 7U, 4U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR));
233 add_config(TensorShape(33U, 27U, 6U, 5U), TensorShape(5U, 7U, 3U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 2, 1, 2, 0, DimensionRoundingType::FLOOR));
234 }
235};
Moritz Pflanzerb3d25792017-07-26 11:49:37 +0100236} // namespace datasets
237} // namespace test
238} // namespace arm_compute
239#endif /* ARM_COMPUTE_TEST_SMALL_CONVOLUTION_LAYER_DATASET */