1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8
9 #include <gtest/gtest.h>
10
11 #include "channel-shuffle-operator-tester.h"
12
13
TEST(CHANNEL_SHUFFLE_NC_X8,two_groups_unit_batch)14 TEST(CHANNEL_SHUFFLE_NC_X8, two_groups_unit_batch) {
15 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
16 ChannelShuffleOperatorTester()
17 .batch_size(1)
18 .groups(2)
19 .group_channels(group_channels)
20 .iterations(3)
21 .TestX8();
22 }
23 }
24
TEST(CHANNEL_SHUFFLE_NC_X8,three_groups_unit_batch)25 TEST(CHANNEL_SHUFFLE_NC_X8, three_groups_unit_batch) {
26 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
27 ChannelShuffleOperatorTester()
28 .batch_size(1)
29 .groups(3)
30 .group_channels(group_channels)
31 .iterations(3)
32 .TestX8();
33 }
34 }
35
TEST(CHANNEL_SHUFFLE_NC_X8,four_groups_unit_batch)36 TEST(CHANNEL_SHUFFLE_NC_X8, four_groups_unit_batch) {
37 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
38 ChannelShuffleOperatorTester()
39 .batch_size(1)
40 .groups(4)
41 .group_channels(group_channels)
42 .iterations(3)
43 .TestX8();
44 }
45 }
46
TEST(CHANNEL_SHUFFLE_NC_X8,many_groups_unit_batch)47 TEST(CHANNEL_SHUFFLE_NC_X8, many_groups_unit_batch) {
48 for (size_t groups = 5; groups < 12; groups += 3) {
49 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
50 ChannelShuffleOperatorTester()
51 .batch_size(1)
52 .groups(groups)
53 .group_channels(group_channels)
54 .iterations(3)
55 .TestX8();
56 }
57 }
58 }
59
TEST(CHANNEL_SHUFFLE_NC_X8,two_groups_small_batch)60 TEST(CHANNEL_SHUFFLE_NC_X8, two_groups_small_batch) {
61 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
62 ChannelShuffleOperatorTester()
63 .batch_size(3)
64 .groups(2)
65 .group_channels(group_channels)
66 .iterations(3)
67 .TestX8();
68 }
69 }
70
TEST(CHANNEL_SHUFFLE_NC_X8,three_groups_small_batch)71 TEST(CHANNEL_SHUFFLE_NC_X8, three_groups_small_batch) {
72 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
73 ChannelShuffleOperatorTester()
74 .batch_size(3)
75 .groups(3)
76 .group_channels(group_channels)
77 .iterations(3)
78 .TestX8();
79 }
80 }
81
TEST(CHANNEL_SHUFFLE_NC_X8,four_groups_small_batch)82 TEST(CHANNEL_SHUFFLE_NC_X8, four_groups_small_batch) {
83 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
84 ChannelShuffleOperatorTester()
85 .batch_size(3)
86 .groups(4)
87 .group_channels(group_channels)
88 .iterations(3)
89 .TestX8();
90 }
91 }
92
TEST(CHANNEL_SHUFFLE_NC_X8,many_groups_small_batch)93 TEST(CHANNEL_SHUFFLE_NC_X8, many_groups_small_batch) {
94 for (size_t groups = 5; groups < 12; groups += 3) {
95 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
96 ChannelShuffleOperatorTester()
97 .batch_size(3)
98 .groups(groups)
99 .group_channels(group_channels)
100 .iterations(3)
101 .TestX8();
102 }
103 }
104 }
105
TEST(CHANNEL_SHUFFLE_NC_X8,two_groups_small_batch_with_input_stride)106 TEST(CHANNEL_SHUFFLE_NC_X8, two_groups_small_batch_with_input_stride) {
107 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
108 ChannelShuffleOperatorTester()
109 .batch_size(3)
110 .groups(2)
111 .group_channels(group_channels)
112 .input_stride(511)
113 .iterations(3)
114 .TestX8();
115 }
116 }
117
TEST(CHANNEL_SHUFFLE_NC_X8,three_groups_small_batch_with_input_stride)118 TEST(CHANNEL_SHUFFLE_NC_X8, three_groups_small_batch_with_input_stride) {
119 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
120 ChannelShuffleOperatorTester()
121 .batch_size(3)
122 .groups(3)
123 .group_channels(group_channels)
124 .input_stride(511)
125 .iterations(3)
126 .TestX8();
127 }
128 }
129
TEST(CHANNEL_SHUFFLE_NC_X8,four_groups_small_batch_with_input_stride)130 TEST(CHANNEL_SHUFFLE_NC_X8, four_groups_small_batch_with_input_stride) {
131 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
132 ChannelShuffleOperatorTester()
133 .batch_size(3)
134 .groups(4)
135 .group_channels(group_channels)
136 .input_stride(511)
137 .iterations(3)
138 .TestX8();
139 }
140 }
141
TEST(CHANNEL_SHUFFLE_NC_X8,many_groups_small_batch_with_input_stride)142 TEST(CHANNEL_SHUFFLE_NC_X8, many_groups_small_batch_with_input_stride) {
143 for (size_t groups = 5; groups < 12; groups += 3) {
144 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
145 ChannelShuffleOperatorTester()
146 .batch_size(3)
147 .groups(groups)
148 .group_channels(group_channels)
149 .input_stride(1007)
150 .iterations(3)
151 .TestX8();
152 }
153 }
154 }
155
TEST(CHANNEL_SHUFFLE_NC_X8,two_groups_small_batch_with_output_stride)156 TEST(CHANNEL_SHUFFLE_NC_X8, two_groups_small_batch_with_output_stride) {
157 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
158 ChannelShuffleOperatorTester()
159 .batch_size(3)
160 .groups(2)
161 .group_channels(group_channels)
162 .output_stride(513)
163 .iterations(3)
164 .TestX8();
165 }
166 }
167
TEST(CHANNEL_SHUFFLE_NC_X8,three_groups_small_batch_with_output_stride)168 TEST(CHANNEL_SHUFFLE_NC_X8, three_groups_small_batch_with_output_stride) {
169 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
170 ChannelShuffleOperatorTester()
171 .batch_size(3)
172 .groups(3)
173 .group_channels(group_channels)
174 .output_stride(513)
175 .iterations(3)
176 .TestX8();
177 }
178 }
179
TEST(CHANNEL_SHUFFLE_NC_X8,four_groups_small_batch_with_output_stride)180 TEST(CHANNEL_SHUFFLE_NC_X8, four_groups_small_batch_with_output_stride) {
181 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
182 ChannelShuffleOperatorTester()
183 .batch_size(3)
184 .groups(4)
185 .group_channels(group_channels)
186 .output_stride(513)
187 .iterations(3)
188 .TestX8();
189 }
190 }
191
TEST(CHANNEL_SHUFFLE_NC_X8,many_groups_small_batch_with_output_stride)192 TEST(CHANNEL_SHUFFLE_NC_X8, many_groups_small_batch_with_output_stride) {
193 for (size_t groups = 5; groups < 12; groups += 3) {
194 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
195 ChannelShuffleOperatorTester()
196 .batch_size(3)
197 .groups(groups)
198 .group_channels(group_channels)
199 .output_stride(1111)
200 .iterations(3)
201 .TestX8();
202 }
203 }
204 }
205
TEST(CHANNEL_SHUFFLE_NC_X8,two_groups_small_batch_with_input_and_output_stride)206 TEST(CHANNEL_SHUFFLE_NC_X8, two_groups_small_batch_with_input_and_output_stride) {
207 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
208 ChannelShuffleOperatorTester()
209 .batch_size(3)
210 .groups(2)
211 .group_channels(group_channels)
212 .input_stride(511)
213 .output_stride(513)
214 .iterations(3)
215 .TestX8();
216 }
217 }
218
TEST(CHANNEL_SHUFFLE_NC_X8,three_groups_small_batch_with_input_and_output_stride)219 TEST(CHANNEL_SHUFFLE_NC_X8, three_groups_small_batch_with_input_and_output_stride) {
220 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
221 ChannelShuffleOperatorTester()
222 .batch_size(3)
223 .groups(3)
224 .group_channels(group_channels)
225 .input_stride(511)
226 .output_stride(513)
227 .iterations(3)
228 .TestX8();
229 }
230 }
231
TEST(CHANNEL_SHUFFLE_NC_X8,four_groups_small_batch_with_input_and_output_stride)232 TEST(CHANNEL_SHUFFLE_NC_X8, four_groups_small_batch_with_input_and_output_stride) {
233 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
234 ChannelShuffleOperatorTester()
235 .batch_size(3)
236 .groups(4)
237 .group_channels(group_channels)
238 .input_stride(511)
239 .output_stride(513)
240 .iterations(3)
241 .TestX8();
242 }
243 }
244
TEST(CHANNEL_SHUFFLE_NC_X8,many_groups_small_batch_with_input_and_output_stride)245 TEST(CHANNEL_SHUFFLE_NC_X8, many_groups_small_batch_with_input_and_output_stride) {
246 for (size_t groups = 5; groups < 12; groups += 3) {
247 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
248 ChannelShuffleOperatorTester()
249 .batch_size(3)
250 .groups(groups)
251 .group_channels(group_channels)
252 .input_stride(1007)
253 .output_stride(1111)
254 .iterations(3)
255 .TestX8();
256 }
257 }
258 }
259
TEST(CHANNEL_SHUFFLE_NC_X32,two_groups_unit_batch)260 TEST(CHANNEL_SHUFFLE_NC_X32, two_groups_unit_batch) {
261 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
262 ChannelShuffleOperatorTester()
263 .batch_size(1)
264 .groups(2)
265 .group_channels(group_channels)
266 .iterations(3)
267 .TestX32();
268 }
269 }
270
TEST(CHANNEL_SHUFFLE_NC_X32,three_groups_unit_batch)271 TEST(CHANNEL_SHUFFLE_NC_X32, three_groups_unit_batch) {
272 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
273 ChannelShuffleOperatorTester()
274 .batch_size(1)
275 .groups(3)
276 .group_channels(group_channels)
277 .iterations(3)
278 .TestX32();
279 }
280 }
281
TEST(CHANNEL_SHUFFLE_NC_X32,four_groups_unit_batch)282 TEST(CHANNEL_SHUFFLE_NC_X32, four_groups_unit_batch) {
283 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
284 ChannelShuffleOperatorTester()
285 .batch_size(1)
286 .groups(4)
287 .group_channels(group_channels)
288 .iterations(3)
289 .TestX32();
290 }
291 }
292
TEST(CHANNEL_SHUFFLE_NC_X32,many_groups_unit_batch)293 TEST(CHANNEL_SHUFFLE_NC_X32, many_groups_unit_batch) {
294 for (size_t groups = 5; groups < 12; groups += 3) {
295 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
296 ChannelShuffleOperatorTester()
297 .batch_size(1)
298 .groups(groups)
299 .group_channels(group_channels)
300 .iterations(3)
301 .TestX32();
302 }
303 }
304 }
305
TEST(CHANNEL_SHUFFLE_NC_X32,two_groups_small_batch)306 TEST(CHANNEL_SHUFFLE_NC_X32, two_groups_small_batch) {
307 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
308 ChannelShuffleOperatorTester()
309 .batch_size(3)
310 .groups(2)
311 .group_channels(group_channels)
312 .iterations(3)
313 .TestX32();
314 }
315 }
316
TEST(CHANNEL_SHUFFLE_NC_X32,three_groups_small_batch)317 TEST(CHANNEL_SHUFFLE_NC_X32, three_groups_small_batch) {
318 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
319 ChannelShuffleOperatorTester()
320 .batch_size(3)
321 .groups(3)
322 .group_channels(group_channels)
323 .iterations(3)
324 .TestX32();
325 }
326 }
327
TEST(CHANNEL_SHUFFLE_NC_X32,four_groups_small_batch)328 TEST(CHANNEL_SHUFFLE_NC_X32, four_groups_small_batch) {
329 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
330 ChannelShuffleOperatorTester()
331 .batch_size(3)
332 .groups(4)
333 .group_channels(group_channels)
334 .iterations(3)
335 .TestX32();
336 }
337 }
338
TEST(CHANNEL_SHUFFLE_NC_X32,many_groups_small_batch)339 TEST(CHANNEL_SHUFFLE_NC_X32, many_groups_small_batch) {
340 for (size_t groups = 5; groups < 12; groups += 3) {
341 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
342 ChannelShuffleOperatorTester()
343 .batch_size(3)
344 .groups(groups)
345 .group_channels(group_channels)
346 .iterations(3)
347 .TestX32();
348 }
349 }
350 }
351
TEST(CHANNEL_SHUFFLE_NC_X32,two_groups_small_batch_with_input_stride)352 TEST(CHANNEL_SHUFFLE_NC_X32, two_groups_small_batch_with_input_stride) {
353 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
354 ChannelShuffleOperatorTester()
355 .batch_size(3)
356 .groups(2)
357 .group_channels(group_channels)
358 .input_stride(511)
359 .iterations(3)
360 .TestX32();
361 }
362 }
363
TEST(CHANNEL_SHUFFLE_NC_X32,three_groups_small_batch_with_input_stride)364 TEST(CHANNEL_SHUFFLE_NC_X32, three_groups_small_batch_with_input_stride) {
365 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
366 ChannelShuffleOperatorTester()
367 .batch_size(3)
368 .groups(3)
369 .group_channels(group_channels)
370 .input_stride(511)
371 .iterations(3)
372 .TestX32();
373 }
374 }
375
TEST(CHANNEL_SHUFFLE_NC_X32,four_groups_small_batch_with_input_stride)376 TEST(CHANNEL_SHUFFLE_NC_X32, four_groups_small_batch_with_input_stride) {
377 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
378 ChannelShuffleOperatorTester()
379 .batch_size(3)
380 .groups(4)
381 .group_channels(group_channels)
382 .input_stride(511)
383 .iterations(3)
384 .TestX32();
385 }
386 }
387
TEST(CHANNEL_SHUFFLE_NC_X32,many_groups_small_batch_with_input_stride)388 TEST(CHANNEL_SHUFFLE_NC_X32, many_groups_small_batch_with_input_stride) {
389 for (size_t groups = 5; groups < 12; groups += 3) {
390 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
391 ChannelShuffleOperatorTester()
392 .batch_size(3)
393 .groups(groups)
394 .group_channels(group_channels)
395 .input_stride(1007)
396 .iterations(3)
397 .TestX32();
398 }
399 }
400 }
401
TEST(CHANNEL_SHUFFLE_NC_X32,two_groups_small_batch_with_output_stride)402 TEST(CHANNEL_SHUFFLE_NC_X32, two_groups_small_batch_with_output_stride) {
403 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
404 ChannelShuffleOperatorTester()
405 .batch_size(3)
406 .groups(2)
407 .group_channels(group_channels)
408 .output_stride(513)
409 .iterations(3)
410 .TestX32();
411 }
412 }
413
TEST(CHANNEL_SHUFFLE_NC_X32,three_groups_small_batch_with_output_stride)414 TEST(CHANNEL_SHUFFLE_NC_X32, three_groups_small_batch_with_output_stride) {
415 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
416 ChannelShuffleOperatorTester()
417 .batch_size(3)
418 .groups(3)
419 .group_channels(group_channels)
420 .output_stride(513)
421 .iterations(3)
422 .TestX32();
423 }
424 }
425
TEST(CHANNEL_SHUFFLE_NC_X32,four_groups_small_batch_with_output_stride)426 TEST(CHANNEL_SHUFFLE_NC_X32, four_groups_small_batch_with_output_stride) {
427 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
428 ChannelShuffleOperatorTester()
429 .batch_size(3)
430 .groups(4)
431 .group_channels(group_channels)
432 .output_stride(513)
433 .iterations(3)
434 .TestX32();
435 }
436 }
437
TEST(CHANNEL_SHUFFLE_NC_X32,many_groups_small_batch_with_output_stride)438 TEST(CHANNEL_SHUFFLE_NC_X32, many_groups_small_batch_with_output_stride) {
439 for (size_t groups = 5; groups < 12; groups += 3) {
440 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
441 ChannelShuffleOperatorTester()
442 .batch_size(3)
443 .groups(groups)
444 .group_channels(group_channels)
445 .output_stride(1111)
446 .iterations(3)
447 .TestX32();
448 }
449 }
450 }
451
TEST(CHANNEL_SHUFFLE_NC_X32,two_groups_small_batch_with_input_and_output_stride)452 TEST(CHANNEL_SHUFFLE_NC_X32, two_groups_small_batch_with_input_and_output_stride) {
453 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
454 ChannelShuffleOperatorTester()
455 .batch_size(3)
456 .groups(2)
457 .group_channels(group_channels)
458 .input_stride(511)
459 .output_stride(513)
460 .iterations(3)
461 .TestX32();
462 }
463 }
464
TEST(CHANNEL_SHUFFLE_NC_X32,three_groups_small_batch_with_input_and_output_stride)465 TEST(CHANNEL_SHUFFLE_NC_X32, three_groups_small_batch_with_input_and_output_stride) {
466 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
467 ChannelShuffleOperatorTester()
468 .batch_size(3)
469 .groups(3)
470 .group_channels(group_channels)
471 .input_stride(511)
472 .output_stride(513)
473 .iterations(3)
474 .TestX32();
475 }
476 }
477
TEST(CHANNEL_SHUFFLE_NC_X32,four_groups_small_batch_with_input_and_output_stride)478 TEST(CHANNEL_SHUFFLE_NC_X32, four_groups_small_batch_with_input_and_output_stride) {
479 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
480 ChannelShuffleOperatorTester()
481 .batch_size(3)
482 .groups(4)
483 .group_channels(group_channels)
484 .input_stride(511)
485 .output_stride(513)
486 .iterations(3)
487 .TestX32();
488 }
489 }
490
TEST(CHANNEL_SHUFFLE_NC_X32,many_groups_small_batch_with_input_and_output_stride)491 TEST(CHANNEL_SHUFFLE_NC_X32, many_groups_small_batch_with_input_and_output_stride) {
492 for (size_t groups = 5; groups < 12; groups += 3) {
493 for (size_t group_channels = 1; group_channels < 100; group_channels += 15) {
494 ChannelShuffleOperatorTester()
495 .batch_size(3)
496 .groups(groups)
497 .group_channels(group_channels)
498 .input_stride(1007)
499 .output_stride(1111)
500 .iterations(3)
501 .TestX32();
502 }
503 }
504 }
505