17
static int test_pooling1d(int w, int h, int pooling_type, int kernel, int stride, int pad, int global_pooling, int pad_mode, int avgpool_count_include_pad, int adaptive_pooling, int out_w)
19
ncnn::Mat a = RandomMat(w, h);
22
pd.set(0, pooling_type);
26
pd.set(4, global_pooling);
28
pd.set(6, avgpool_count_include_pad);
29
pd.set(7, adaptive_pooling);
32
std::vector<ncnn::Mat> weights(0);
34
int ret = test_layer("Pooling1D", pd, weights, a);
37
fprintf(stderr, "test_pooling1d failed w=%d h=%d pooling_type=%d kernel=%d stride=%d pad=%d global_pooling=%d pad_mode=%d avgpool_count_include_pad=%d adaptive_pooling=%d out_w=%d\n", w, h, pooling_type, kernel, stride, pad, global_pooling, pad_mode, avgpool_count_include_pad, adaptive_pooling, out_w);
43
static int test_pooling1d_0()
45
static const int ksp[11][3] = {
59
for (int i = 0; i < 11; i++)
62
|| test_pooling1d(9, 1, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 0, 0, 0, 0)
63
|| test_pooling1d(9, 2, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 1, 0, 0, 0)
64
|| test_pooling1d(9, 3, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 2, 0, 0, 0)
65
|| test_pooling1d(9, 4, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 3, 0, 0, 0)
66
|| test_pooling1d(9, 7, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 0, 0, 0, 0)
67
|| test_pooling1d(9, 8, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 1, 0, 0, 0)
68
|| test_pooling1d(9, 15, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 2, 0, 0, 0)
69
|| test_pooling1d(9, 16, 0, ksp[i][0], ksp[i][1], ksp[i][2], 0, 3, 0, 0, 0);
78
static int test_pooling1d_1()
80
static const int ksp[11][3] = {
94
for (int i = 0; i < 11; i++)
97
|| test_pooling1d(9, 1, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 0, 0, 0, 0)
98
|| test_pooling1d(9, 2, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 1, 0, 0, 0)
99
|| test_pooling1d(9, 3, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 0, 1, 0, 0)
100
|| test_pooling1d(9, 4, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 1, 0, 0, 0)
101
|| test_pooling1d(9, 7, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 0, 0, 0, 0)
102
|| test_pooling1d(9, 8, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 1, 1, 0, 0)
103
|| test_pooling1d(9, 12, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 2, 1, 0, 0)
104
|| test_pooling1d(9, 15, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 0, 0, 0, 0)
105
|| test_pooling1d(9, 16, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 1, 0, 0, 0)
106
|| test_pooling1d(9, 64, 1, ksp[i][0], ksp[i][1], ksp[i][2], 0, 3, 1, 0, 0);
115
static int test_pooling1d_2()
118
|| test_pooling1d(2, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0)
119
|| test_pooling1d(5, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0)
120
|| test_pooling1d(3, 3, 0, 1, 1, 0, 1, 0, 0, 0, 0)
121
|| test_pooling1d(6, 3, 1, 1, 1, 0, 1, 0, 0, 0, 0)
122
|| test_pooling1d(4, 4, 0, 1, 1, 0, 1, 0, 0, 0, 0)
123
|| test_pooling1d(6, 4, 1, 1, 1, 0, 1, 0, 0, 0, 0)
124
|| test_pooling1d(8, 8, 0, 1, 1, 0, 1, 0, 0, 0, 0)
125
|| test_pooling1d(7, 8, 1, 1, 1, 0, 1, 0, 0, 0, 0)
126
|| test_pooling1d(11, 16, 0, 1, 1, 0, 1, 0, 0, 0, 0)
127
|| test_pooling1d(13, 16, 1, 1, 1, 0, 1, 0, 0, 0, 0)
128
|| test_pooling1d(48, 4, 0, 2, 2, 0, 0, 0, 0, 0, 0)
129
|| test_pooling1d(48, 15, 0, 2, 2, 1, 0, 0, 0, 0, 0);
133
static int test_pooling1d_3()
136
|| test_pooling1d(2, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1)
137
|| test_pooling1d(2, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2)
138
|| test_pooling1d(2, 1, 1, 1, 1, 0, 0, 0, 0, 1, 3)
139
|| test_pooling1d(2, 1, 1, 1, 1, 0, 0, 0, 0, 1, 4)
140
|| test_pooling1d(2, 1, 1, 1, 1, 0, 0, 0, 0, 1, 5)
141
|| test_pooling1d(2, 1, 1, 1, 1, 0, 0, 0, 0, 1, 6)
142
|| test_pooling1d(5, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1)
143
|| test_pooling1d(5, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2)
144
|| test_pooling1d(5, 1, 1, 1, 1, 0, 0, 0, 0, 1, 3)
145
|| test_pooling1d(5, 1, 1, 1, 1, 0, 0, 0, 0, 1, 4)
146
|| test_pooling1d(5, 1, 1, 1, 1, 0, 0, 0, 0, 1, 5)
147
|| test_pooling1d(5, 1, 1, 1, 1, 0, 0, 0, 0, 1, 6)
148
|| test_pooling1d(3, 3, 1, 1, 1, 0, 0, 0, 0, 1, 1)
149
|| test_pooling1d(3, 3, 1, 1, 1, 0, 0, 0, 0, 1, 2)
150
|| test_pooling1d(3, 3, 1, 1, 1, 0, 0, 0, 0, 1, 3)
151
|| test_pooling1d(3, 3, 1, 1, 1, 0, 0, 0, 0, 1, 4)
152
|| test_pooling1d(3, 3, 1, 1, 1, 0, 0, 0, 0, 1, 5)
153
|| test_pooling1d(3, 3, 1, 1, 1, 0, 0, 0, 0, 1, 6)
154
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 1)
155
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 2)
156
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 3)
157
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 4)
158
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 5)
159
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 6)
160
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 7)
161
|| test_pooling1d(4, 4, 1, 1, 1, 0, 0, 0, 0, 1, 8)
162
|| test_pooling1d(6, 4, 1, 1, 1, 0, 0, 0, 0, 1, 1)
163
|| test_pooling1d(6, 4, 1, 1, 1, 0, 0, 0, 0, 1, 2)
164
|| test_pooling1d(6, 4, 1, 1, 1, 0, 0, 0, 0, 1, 3)
165
|| test_pooling1d(6, 4, 1, 1, 1, 0, 0, 0, 0, 1, 4)
166
|| test_pooling1d(6, 4, 1, 1, 1, 0, 0, 0, 0, 1, 5)
167
|| test_pooling1d(6, 4, 1, 1, 1, 0, 0, 0, 0, 1, 6)
168
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 1)
169
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 2)
170
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 3)
171
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 4)
172
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 5)
173
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 6)
174
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 7)
175
|| test_pooling1d(8, 8, 1, 1, 1, 0, 0, 0, 0, 1, 8)
176
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 1)
177
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 3)
178
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 5)
179
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 7)
180
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 9)
181
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 11)
182
|| test_pooling1d(11, 16, 1, 1, 1, 0, 0, 0, 1, 0, 13)
183
|| test_pooling1d(13, 16, 1, 1, 1, 0, 0, 0, 1, 0, 2)
184
|| test_pooling1d(13, 16, 1, 1, 1, 0, 0, 0, 1, 0, 4)
185
|| test_pooling1d(13, 16, 1, 1, 1, 0, 0, 0, 1, 0, 6)
186
|| test_pooling1d(13, 16, 1, 1, 1, 0, 0, 0, 1, 0, 8)
187
|| test_pooling1d(13, 16, 1, 1, 1, 0, 0, 0, 1, 0, 10)
188
|| test_pooling1d(13, 16, 1, 1, 1, 0, 0, 0, 1, 0, 12);
192
static int test_pooling1d_4()
195
|| test_pooling1d(2, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1)
196
|| test_pooling1d(2, 1, 0, 1, 1, 0, 0, 0, 0, 1, 2)
197
|| test_pooling1d(2, 1, 0, 1, 1, 0, 0, 0, 0, 1, 3)
198
|| test_pooling1d(2, 1, 0, 1, 1, 0, 0, 0, 0, 1, 4)
199
|| test_pooling1d(2, 1, 0, 1, 1, 0, 0, 0, 0, 1, 5)
200
|| test_pooling1d(2, 1, 0, 1, 1, 0, 0, 0, 0, 1, 6)
201
|| test_pooling1d(5, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1)
202
|| test_pooling1d(5, 1, 0, 1, 1, 0, 0, 0, 0, 1, 2)
203
|| test_pooling1d(5, 1, 0, 1, 1, 0, 0, 0, 0, 1, 3)
204
|| test_pooling1d(5, 1, 0, 1, 1, 0, 0, 0, 0, 1, 4)
205
|| test_pooling1d(5, 1, 0, 1, 1, 0, 0, 0, 0, 1, 5)
206
|| test_pooling1d(5, 1, 0, 1, 1, 0, 0, 0, 0, 1, 6)
207
|| test_pooling1d(3, 3, 0, 1, 1, 0, 0, 0, 0, 1, 1)
208
|| test_pooling1d(3, 3, 0, 1, 1, 0, 0, 0, 0, 1, 2)
209
|| test_pooling1d(3, 3, 0, 1, 1, 0, 0, 0, 0, 1, 3)
210
|| test_pooling1d(3, 3, 0, 1, 1, 0, 0, 0, 0, 1, 4)
211
|| test_pooling1d(3, 3, 0, 1, 1, 0, 0, 0, 0, 1, 5)
212
|| test_pooling1d(3, 3, 0, 1, 1, 0, 0, 0, 0, 1, 6)
213
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 1)
214
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 2)
215
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 3)
216
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 4)
217
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 5)
218
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 6)
219
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 7)
220
|| test_pooling1d(4, 4, 0, 1, 1, 0, 0, 0, 0, 1, 8)
221
|| test_pooling1d(6, 4, 0, 1, 1, 0, 0, 0, 0, 1, 1)
222
|| test_pooling1d(6, 4, 0, 1, 1, 0, 0, 0, 0, 1, 2)
223
|| test_pooling1d(6, 4, 0, 1, 1, 0, 0, 0, 0, 1, 3)
224
|| test_pooling1d(6, 4, 0, 1, 1, 0, 0, 0, 0, 1, 4)
225
|| test_pooling1d(6, 4, 0, 1, 1, 0, 0, 0, 0, 1, 5)
226
|| test_pooling1d(6, 4, 0, 1, 1, 0, 0, 0, 0, 1, 6)
227
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 1)
228
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 2)
229
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 3)
230
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 4)
231
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 5)
232
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 6)
233
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 7)
234
|| test_pooling1d(8, 8, 0, 1, 1, 0, 0, 0, 0, 1, 8)
235
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 1)
236
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 3)
237
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 5)
238
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 7)
239
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 9)
240
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 11)
241
|| test_pooling1d(11, 16, 0, 1, 1, 0, 0, 0, 1, 0, 13)
242
|| test_pooling1d(13, 16, 0, 1, 1, 0, 0, 0, 1, 0, 2)
243
|| test_pooling1d(13, 16, 0, 1, 1, 0, 0, 0, 1, 0, 4)
244
|| test_pooling1d(13, 16, 0, 1, 1, 0, 0, 0, 1, 0, 6)
245
|| test_pooling1d(13, 16, 0, 1, 1, 0, 0, 0, 1, 0, 8)
246
|| test_pooling1d(13, 16, 0, 1, 1, 0, 0, 0, 1, 0, 10)
247
|| test_pooling1d(13, 16, 0, 1, 1, 0, 0, 0, 1, 0, 12);
255
|| test_pooling1d_0()
256
|| test_pooling1d_1()
257
|| test_pooling1d_2()
258
|| test_pooling1d_3()
259
|| test_pooling1d_4();