xref: /aosp_15_r20/external/XNNPACK/test/convolution-nhwc.cc (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
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 <xnnpack/common.h>
10 
11 #include <gtest/gtest.h>
12 
13 #include "convolution-operator-tester.h"
14 
15 
16 TEST(CONVOLUTION_NHWC_QC8, 1x1) {
17   ConvolutionOperatorTester()
18     .input_size(27, 29)
19     .kernel_size(1, 1)
20     .group_input_channels(23)
21     .group_output_channels(19)
22     .iterations(3)
23     .TestNHWCxQC8();
24 }
25 
26 TEST(CONVOLUTION_NHWC_QC8, 1x1_with_qmin) {
27   ConvolutionOperatorTester()
28     .input_size(27, 29)
29     .kernel_size(1, 1)
30     .group_input_channels(23)
31     .group_output_channels(19)
32     .qmin(128)
33     .iterations(3)
34     .TestNHWCxQC8();
35 }
36 
37 TEST(CONVOLUTION_NHWC_QC8, 1x1_with_qmax) {
38   ConvolutionOperatorTester()
39     .input_size(27, 29)
40     .kernel_size(1, 1)
41     .group_input_channels(23)
42     .group_output_channels(19)
43     .qmax(128)
44     .iterations(3)
45     .TestNHWCxQC8();
46 }
47 
48 TEST(CONVOLUTION_NHWC_QC8, 1x1_with_input_stride) {
49   ConvolutionOperatorTester()
50     .input_size(27, 29)
51     .kernel_size(1, 1)
52     .input_channel_stride(28)
53     .group_input_channels(23)
54     .group_output_channels(19)
55     .iterations(3)
56     .TestNHWCxQC8();
57 }
58 
59 TEST(CONVOLUTION_NHWC_QC8, 1x1_with_output_stride) {
60   ConvolutionOperatorTester()
61     .input_size(27, 29)
62     .kernel_size(1, 1)
63     .output_channel_stride(29)
64     .group_input_channels(23)
65     .group_output_channels(19)
66     .iterations(3)
67     .TestNHWCxQC8();
68 }
69 
70 TEST(CONVOLUTION_NHWC_QC8, 1x1_without_bias) {
71   ConvolutionOperatorTester()
72     .has_bias(false)
73     .input_size(13, 14)
74     .kernel_size(1, 1)
75     .group_input_channels(23)
76     .group_output_channels(19)
77     .iterations(3)
78     .TestNHWCxQC8();
79 }
80 
81 TEST(CONVOLUTION_NHWC_QC8, 1x1_with_batch) {
82   ConvolutionOperatorTester()
83     .batch_size(3)
84     .input_size(13, 14)
85     .kernel_size(1, 1)
86     .group_input_channels(23)
87     .group_output_channels(19)
88     .iterations(3)
89     .TestNHWCxQC8();
90 }
91 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1)92 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1) {
93   ConvolutionOperatorTester()
94     .input_size(24, 25)
95     .kernel_size(1, 1)
96     .groups(2)
97     .group_input_channels(17)
98     .group_output_channels(19)
99     .iterations(3)
100     .TestNHWCxQC8();
101 }
102 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1_with_qmin)103 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1_with_qmin) {
104   ConvolutionOperatorTester()
105     .input_size(24, 25)
106     .kernel_size(1, 1)
107     .groups(2)
108     .group_input_channels(17)
109     .group_output_channels(19)
110     .qmin(128)
111     .iterations(3)
112     .TestNHWCxQC8();
113 }
114 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1_with_qmax)115 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1_with_qmax) {
116   ConvolutionOperatorTester()
117     .input_size(24, 25)
118     .kernel_size(1, 1)
119     .groups(2)
120     .group_input_channels(17)
121     .group_output_channels(19)
122     .qmax(128)
123     .iterations(3)
124     .TestNHWCxQC8();
125 }
126 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1_with_input_stride)127 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1_with_input_stride) {
128   ConvolutionOperatorTester()
129     .input_size(24, 25)
130     .kernel_size(1, 1)
131     .groups(2)
132     .input_channel_stride(37)
133     .group_input_channels(17)
134     .group_output_channels(19)
135     .iterations(3)
136     .TestNHWCxQC8();
137 }
138 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1_with_output_stride)139 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1_with_output_stride) {
140   ConvolutionOperatorTester()
141     .input_size(24, 25)
142     .kernel_size(1, 1)
143     .groups(2)
144     .output_channel_stride(41)
145     .group_input_channels(17)
146     .group_output_channels(19)
147     .iterations(3)
148     .TestNHWCxQC8();
149 }
150 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1_without_bias)151 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1_without_bias) {
152   ConvolutionOperatorTester()
153     .has_bias(false)
154     .input_size(24, 25)
155     .kernel_size(1, 1)
156     .groups(2)
157     .group_input_channels(17)
158     .group_output_channels(19)
159     .iterations(3)
160     .TestNHWCxQC8();
161 }
162 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x1_with_batch)163 TEST(CONVOLUTION_NHWC_QC8, grouped_1x1_with_batch) {
164   ConvolutionOperatorTester()
165     .batch_size(3)
166     .input_size(24, 25)
167     .kernel_size(1, 1)
168     .groups(2)
169     .group_input_channels(17)
170     .group_output_channels(19)
171     .iterations(3)
172     .TestNHWCxQC8();
173 }
174 
175 TEST(CONVOLUTION_NHWC_QC8, 1x3) {
176   ConvolutionOperatorTester()
177     .input_size(20, 19)
178     .padding_width(1)
179     .kernel_size(1, 3)
180     .group_input_channels(17)
181     .group_output_channels(15)
182     .iterations(3)
183     .TestNHWCxQC8();
184 }
185 
TEST(CONVOLUTION_NHWC_QC8,grouped_1x3)186 TEST(CONVOLUTION_NHWC_QC8, grouped_1x3) {
187   ConvolutionOperatorTester()
188     .input_size(20, 19)
189     .padding_width(1)
190     .kernel_size(1, 3)
191     .groups(2)
192     .group_input_channels(17)
193     .group_output_channels(15)
194     .iterations(3)
195     .TestNHWCxQC8();
196 }
197 
198 TEST(CONVOLUTION_NHWC_QC8, 3x1) {
199   ConvolutionOperatorTester()
200     .input_size(19, 20)
201     .padding_height(1)
202     .kernel_size(3, 1)
203     .group_input_channels(17)
204     .group_output_channels(15)
205     .iterations(3)
206     .TestNHWCxQC8();
207 }
208 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x1)209 TEST(CONVOLUTION_NHWC_QC8, grouped_3x1) {
210   ConvolutionOperatorTester()
211     .input_size(19, 20)
212     .padding_height(1)
213     .kernel_size(3, 1)
214     .groups(2)
215     .group_input_channels(17)
216     .group_output_channels(15)
217     .iterations(3)
218     .TestNHWCxQC8();
219 }
220 
221 TEST(CONVOLUTION_NHWC_QC8, 3x3) {
222   ConvolutionOperatorTester()
223     .input_size(13, 12)
224     .padding(1)
225     .kernel_size(3, 3)
226     .group_input_channels(15)
227     .group_output_channels(17)
228     .iterations(3)
229     .TestNHWCxQC8();
230 }
231 
232 TEST(CONVOLUTION_NHWC_QC8, 3x3_without_padding) {
233   ConvolutionOperatorTester()
234     .input_size(13, 12)
235     .kernel_size(3, 3)
236     .group_input_channels(15)
237     .group_output_channels(17)
238     .iterations(3)
239     .TestNHWCxQC8();
240 }
241 
242 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_left_padding) {
243   ConvolutionOperatorTester()
244     .input_size(13, 12)
245     .padding_left(1)
246     .kernel_size(3, 3)
247     .group_input_channels(15)
248     .group_output_channels(17)
249     .iterations(3)
250     .TestNHWCxQC8();
251 }
252 
253 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_right_padding) {
254   ConvolutionOperatorTester()
255     .input_size(13, 12)
256     .padding_right(1)
257     .kernel_size(3, 3)
258     .group_input_channels(15)
259     .group_output_channels(17)
260     .iterations(3)
261     .TestNHWCxQC8();
262 }
263 
264 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_top_padding) {
265   ConvolutionOperatorTester()
266     .input_size(13, 12)
267     .padding_top(1)
268     .kernel_size(3, 3)
269     .group_input_channels(15)
270     .group_output_channels(17)
271     .iterations(3)
272     .TestNHWCxQC8();
273 }
274 
275 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_bottom_padding) {
276   ConvolutionOperatorTester()
277     .input_size(13, 12)
278     .padding_bottom(1)
279     .kernel_size(3, 3)
280     .group_input_channels(15)
281     .group_output_channels(17)
282     .iterations(3)
283     .TestNHWCxQC8();
284 }
285 
286 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_input_stride) {
287   ConvolutionOperatorTester()
288     .input_size(13, 12)
289     .padding(1)
290     .kernel_size(3, 3)
291     .input_channel_stride(22)
292     .group_input_channels(15)
293     .group_output_channels(17)
294     .iterations(3)
295     .TestNHWCxQC8();
296 }
297 
298 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_output_stride) {
299   ConvolutionOperatorTester()
300     .input_size(13, 12)
301     .padding(1)
302     .kernel_size(3, 3)
303     .output_channel_stride(23)
304     .group_input_channels(15)
305     .group_output_channels(17)
306     .iterations(3)
307     .TestNHWCxQC8();
308 }
309 
310 TEST(CONVOLUTION_NHWC_QC8, 3x3_without_bias) {
311   ConvolutionOperatorTester()
312     .has_bias(false)
313     .input_size(10, 9)
314     .padding(1)
315     .kernel_size(3, 3)
316     .group_input_channels(15)
317     .group_output_channels(17)
318     .iterations(3)
319     .TestNHWCxQC8();
320 }
321 
322 TEST(CONVOLUTION_NHWC_QC8, 3x3_with_batch) {
323   ConvolutionOperatorTester()
324     .batch_size(3)
325     .input_size(10, 9)
326     .padding(1)
327     .kernel_size(3, 3)
328     .group_input_channels(15)
329     .group_output_channels(17)
330     .iterations(3)
331     .TestNHWCxQC8();
332 }
333 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3)334 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3) {
335   ConvolutionOperatorTester()
336     .input_size(10, 11)
337     .padding(1)
338     .kernel_size(3, 3)
339     .groups(2)
340     .group_input_channels(14)
341     .group_output_channels(13)
342     .iterations(3)
343     .TestNHWCxQC8();
344 }
345 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_without_padding)346 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_without_padding) {
347   ConvolutionOperatorTester()
348     .input_size(13, 12)
349     .kernel_size(3, 3)
350     .group_input_channels(15)
351     .group_output_channels(17)
352     .iterations(3)
353     .TestNHWCxQC8();
354 }
355 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_left_padding)356 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_left_padding) {
357   ConvolutionOperatorTester()
358     .input_size(10, 11)
359     .padding_left(1)
360     .kernel_size(3, 3)
361     .groups(2)
362     .group_input_channels(14)
363     .group_output_channels(13)
364     .iterations(3)
365     .TestNHWCxQC8();
366 }
367 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_right_padding)368 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_right_padding) {
369   ConvolutionOperatorTester()
370     .input_size(10, 11)
371     .padding_right(1)
372     .kernel_size(3, 3)
373     .groups(2)
374     .group_input_channels(14)
375     .group_output_channels(13)
376     .iterations(3)
377     .TestNHWCxQC8();
378 }
379 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_top_padding)380 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_top_padding) {
381   ConvolutionOperatorTester()
382     .input_size(10, 11)
383     .padding_top(1)
384     .kernel_size(3, 3)
385     .groups(2)
386     .group_input_channels(14)
387     .group_output_channels(13)
388     .iterations(3)
389     .TestNHWCxQC8();
390 }
391 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_bottom_padding)392 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_bottom_padding) {
393   ConvolutionOperatorTester()
394     .input_size(10, 11)
395     .padding_bottom(1)
396     .kernel_size(3, 3)
397     .groups(2)
398     .group_input_channels(14)
399     .group_output_channels(13)
400     .iterations(3)
401     .TestNHWCxQC8();
402 }
403 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_input_stride)404 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_input_stride) {
405   ConvolutionOperatorTester()
406     .input_size(10, 11)
407     .padding(1)
408     .kernel_size(3, 3)
409     .groups(2)
410     .input_channel_stride(29)
411     .group_input_channels(14)
412     .group_output_channels(13)
413     .iterations(3)
414     .TestNHWCxQC8();
415 }
416 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_output_stride)417 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_output_stride) {
418   ConvolutionOperatorTester()
419     .input_size(10, 11)
420     .padding(1)
421     .kernel_size(3, 3)
422     .groups(2)
423     .output_channel_stride(31)
424     .group_input_channels(14)
425     .group_output_channels(13)
426     .iterations(3)
427     .TestNHWCxQC8();
428 }
429 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_without_bias)430 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_without_bias) {
431   ConvolutionOperatorTester()
432     .has_bias(false)
433     .input_size(10, 11)
434     .padding(1)
435     .kernel_size(3, 3)
436     .groups(2)
437     .group_input_channels(14)
438     .group_output_channels(13)
439     .iterations(3)
440     .TestNHWCxQC8();
441 }
442 
TEST(CONVOLUTION_NHWC_QC8,grouped_3x3_with_batch)443 TEST(CONVOLUTION_NHWC_QC8, grouped_3x3_with_batch) {
444   ConvolutionOperatorTester()
445     .batch_size(3)
446     .input_size(10, 11)
447     .padding(1)
448     .kernel_size(3, 3)
449     .groups(2)
450     .group_input_channels(14)
451     .group_output_channels(13)
452     .iterations(3)
453     .TestNHWCxQC8();
454 }
455 
456 TEST(CONVOLUTION_NHWC_QC8, 3x3s2) {
457   ConvolutionOperatorTester()
458     .input_size(14, 13)
459     .padding(1)
460     .kernel_size(3, 3)
461     .subsampling(2)
462     .group_input_channels(27)
463     .group_output_channels(19)
464     .iterations(3)
465     .TestNHWCxQC8();
466 }
467 
468 TEST(CONVOLUTION_NHWC_QC8, 3x3s2_with_tf_same_padding) {
469   for (size_t input_height = 13; input_height <= 14; input_height++) {
470     for (size_t input_width = 13; input_width <= 14; input_width++) {
471       ConvolutionOperatorTester()
472         .input_size(input_height, input_width)
473         .padding_tf_same(true)
474         .kernel_size(3, 3)
475         .subsampling(2)
476         .group_input_channels(27)
477         .group_output_channels(19)
478         .iterations(3)
479         .TestNHWCxQC8();
480     }
481   }
482 }
483 
484 TEST(CONVOLUTION_NHWC_QC8, 3x3s1x2) {
485   ConvolutionOperatorTester()
486     .input_size(14, 13)
487     .padding(1)
488     .kernel_size(3, 3)
489     .subsampling(1, 2)
490     .group_input_channels(27)
491     .group_output_channels(19)
492     .iterations(3)
493     .TestNHWCxQC8();
494 }
495 
496 TEST(CONVOLUTION_NHWC_QC8, 3x3s1x2_with_tf_same_padding) {
497   for (size_t input_height = 13; input_height <= 14; input_height++) {
498     for (size_t input_width = 13; input_width <= 14; input_width++) {
499       ConvolutionOperatorTester()
500         .input_size(input_height, input_width)
501         .padding_tf_same(true)
502         .kernel_size(3, 3)
503         .subsampling(1, 2)
504         .group_input_channels(27)
505         .group_output_channels(19)
506         .iterations(3)
507         .TestNHWCxQC8();
508     }
509   }
510 }
511 
512 TEST(CONVOLUTION_NHWC_QC8, 3x3s2x1) {
513   ConvolutionOperatorTester()
514     .input_size(14, 13)
515     .padding(1)
516     .kernel_size(3, 3)
517     .subsampling(2, 1)
518     .group_input_channels(27)
519     .group_output_channels(19)
520     .iterations(3)
521     .TestNHWCxQC8();
522 }
523 
524 TEST(CONVOLUTION_NHWC_QC8, 3x3s2x1_with_tf_same_padding) {
525   for (size_t input_height = 13; input_height <= 14; input_height++) {
526     for (size_t input_width = 13; input_width <= 14; input_width++) {
527       ConvolutionOperatorTester()
528         .input_size(input_height, input_width)
529         .padding_tf_same(true)
530         .kernel_size(3, 3)
531         .subsampling(2, 1)
532         .group_input_channels(27)
533         .group_output_channels(19)
534         .iterations(3)
535         .TestNHWCxQC8();
536     }
537   }
538 }
539 
540 TEST(CONVOLUTION_NHWC_QC8, 3x3d2) {
541   ConvolutionOperatorTester()
542     .input_size(14, 13)
543     .padding(2)
544     .kernel_size(3, 3)
545     .dilation(2)
546     .group_input_channels(27)
547     .group_output_channels(19)
548     .iterations(3)
549     .TestNHWCxQC8();
550 }
551 
552 TEST(CONVOLUTION_NHWC_QC8, 3x3d1x2) {
553   ConvolutionOperatorTester()
554     .input_size(14, 13)
555     .padding(1, 2)
556     .kernel_size(3, 3)
557     .dilation(1, 2)
558     .group_input_channels(27)
559     .group_output_channels(19)
560     .iterations(3)
561     .TestNHWCxQC8();
562 }
563 
564 TEST(CONVOLUTION_NHWC_QC8, 3x3d2x1) {
565   ConvolutionOperatorTester()
566     .input_size(14, 13)
567     .padding(2, 1)
568     .kernel_size(3, 3)
569     .dilation(2, 1)
570     .group_input_channels(27)
571     .group_output_channels(19)
572     .iterations(3)
573     .TestNHWCxQC8();
574 }
575 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3)576 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3) {
577   ConvolutionOperatorTester()
578     .input_size(15, 14)
579     .padding(1, 1)
580     .kernel_size(3, 3)
581     .groups(27)
582     .iterations(3)
583     .TestNHWCxQC8();
584 }
585 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3_without_bias)586 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3_without_bias) {
587   ConvolutionOperatorTester()
588     .has_bias(false)
589     .input_size(15, 14)
590     .padding(1, 1)
591     .kernel_size(3, 3)
592     .groups(27)
593     .iterations(3)
594     .TestNHWCxQC8();
595 }
596 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3s2)597 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3s2) {
598   ConvolutionOperatorTester()
599     .input_size(15, 14)
600     .padding(1, 1)
601     .kernel_size(3, 3)
602     .subsampling(2)
603     .groups(27)
604     .iterations(3)
605     .TestNHWCxQC8();
606 }
607 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3s2_with_tf_same_padding)608 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3s2_with_tf_same_padding) {
609   for (size_t input_height = 14; input_height <= 15; input_height++) {
610     for (size_t input_width = 14; input_width <= 15; input_width++) {
611       ConvolutionOperatorTester()
612         .input_size(input_height, input_width)
613         .padding_tf_same(true)
614         .kernel_size(3, 3)
615         .subsampling(2)
616         .groups(27)
617         .iterations(3)
618         .TestNHWCxQC8();
619     }
620   }
621 }
622 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3s1x2)623 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3s1x2) {
624   ConvolutionOperatorTester()
625     .input_size(15, 14)
626     .padding(1, 1)
627     .kernel_size(3, 3)
628     .subsampling(1, 2)
629     .groups(27)
630     .iterations(3)
631     .TestNHWCxQC8();
632 }
633 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3s1x2_with_tf_same_padding)634 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3s1x2_with_tf_same_padding) {
635   for (size_t input_height = 14; input_height <= 15; input_height++) {
636     for (size_t input_width = 14; input_width <= 15; input_width++) {
637       ConvolutionOperatorTester()
638         .input_size(input_height, input_width)
639         .padding_tf_same(true)
640         .kernel_size(3, 3)
641         .subsampling(1, 2)
642         .groups(27)
643         .iterations(3)
644         .TestNHWCxQC8();
645     }
646   }
647 }
648 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3s2x1)649 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3s2x1) {
650   ConvolutionOperatorTester()
651     .input_size(15, 14)
652     .padding(1, 1)
653     .kernel_size(3, 3)
654     .subsampling(2, 1)
655     .groups(27)
656     .iterations(3)
657     .TestNHWCxQC8();
658 }
659 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3s2x1_with_tf_same_padding)660 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3s2x1_with_tf_same_padding) {
661   for (size_t input_height = 14; input_height <= 15; input_height++) {
662     for (size_t input_width = 14; input_width <= 15; input_width++) {
663       ConvolutionOperatorTester()
664         .input_size(input_height, input_width)
665         .padding_tf_same(true)
666         .kernel_size(3, 3)
667         .subsampling(2, 1)
668         .groups(27)
669         .iterations(3)
670         .TestNHWCxQC8();
671     }
672   }
673 }
674 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3d2)675 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3d2) {
676   ConvolutionOperatorTester()
677     .input_size(15, 14)
678     .padding(1, 1)
679     .kernel_size(3, 3)
680     .dilation(2)
681     .groups(27)
682     .iterations(3)
683     .TestNHWCxQC8();
684 }
685 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3d1x2)686 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3d1x2) {
687   ConvolutionOperatorTester()
688     .input_size(15, 14)
689     .padding(1, 1)
690     .kernel_size(3, 3)
691     .dilation(1, 2)
692     .groups(27)
693     .iterations(3)
694     .TestNHWCxQC8();
695 }
696 
TEST(CONVOLUTION_NHWC_QC8,depthwise_3x3d2x1)697 TEST(CONVOLUTION_NHWC_QC8, depthwise_3x3d2x1) {
698   ConvolutionOperatorTester()
699     .input_size(15, 14)
700     .padding(1, 1)
701     .kernel_size(3, 3)
702     .dilation(2, 1)
703     .groups(27)
704     .iterations(3)
705     .TestNHWCxQC8();
706 }
707 
708 // Tests GEMM microkernel with weights_cache.
TEST(CONVOLUTION_NHWC_QC8,weights_cache_1x1)709 TEST(CONVOLUTION_NHWC_QC8, weights_cache_1x1) {
710   ConvolutionOperatorTester()
711     .input_size(27, 29)
712     .kernel_size(1, 1)
713     .group_input_channels(23)
714     .group_output_channels(19)
715     .use_weights_cache(true)
716     .iterations(3)
717     .TestNHWCxQC8();
718 }
719 
720 // Tests IGEMM microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QC8,weights_cache_3x3)721 TEST(CONVOLUTION_NHWC_QC8, weights_cache_3x3) {
722   ConvolutionOperatorTester()
723     .input_size(13, 12)
724     .padding(1)
725     .kernel_size(3, 3)
726     .group_input_channels(15)
727     .group_output_channels(17)
728     .use_weights_cache(true)
729     .iterations(3)
730     .TestNHWCxQC8();
731 }
732 
733 // Tests vmulcaddc microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QC8,weights_cache_depthwise_1x1)734 TEST(CONVOLUTION_NHWC_QC8, weights_cache_depthwise_1x1) {
735   ConvolutionOperatorTester()
736     .input_size(15, 14)
737     .kernel_size(1, 1)
738     .groups(24)
739     .use_weights_cache(true)
740     .iterations(3)
741     .TestNHWCxQC8();
742 }
743 
744 // Tests dwconv microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QC8,weights_cache_depthwise_2x2d2)745 TEST(CONVOLUTION_NHWC_QC8, weights_cache_depthwise_2x2d2) {
746   ConvolutionOperatorTester()
747     .input_size(15, 14)
748     .padding(1, 1)
749     .kernel_size(2, 2)
750     .dilation(2)
751     .groups(27)
752     .iterations(3)
753     .use_weights_cache(true)
754     .TestNHWCxQC8();
755 }
756 
757 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 1x1) {
758   ConvolutionOperatorTester()
759     .depthwise_layout(true)
760     .input_size(15, 14)
761     .kernel_size(1, 1)
762     .groups(24)
763     .iterations(3)
764     .TestNHWCxQC8();
765 }
766 
767 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 1x1_with_depth_multiplier) {
768   ConvolutionOperatorTester()
769     .depthwise_layout(true)
770     .input_size(15, 14)
771     .kernel_size(1, 1)
772     .groups(24)
773     .group_output_channels(3)
774     .iterations(3)
775     .TestNHWCxQC8();
776 }
777 
778 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 1x1_without_bias) {
779   ConvolutionOperatorTester()
780     .depthwise_layout(true)
781     .has_bias(false)
782     .input_size(15, 14)
783     .kernel_size(1, 1)
784     .groups(24)
785     .iterations(3)
786     .TestNHWCxQC8();
787 }
788 
789 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 2x2) {
790   ConvolutionOperatorTester()
791     .depthwise_layout(true)
792     .input_size(15, 14)
793     .padding(1, 1)
794     .kernel_size(2, 2)
795     .groups(24)
796     .iterations(3)
797     .TestNHWCxQC8();
798 }
799 
800 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 2x2_with_depth_multiplier) {
801   ConvolutionOperatorTester()
802     .depthwise_layout(true)
803     .input_size(15, 14)
804     .padding(1, 1)
805     .kernel_size(2, 2)
806     .groups(24)
807     .group_output_channels(3)
808     .iterations(3)
809     .TestNHWCxQC8();
810 }
811 
812 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 2x2_without_bias) {
813   ConvolutionOperatorTester()
814     .depthwise_layout(true)
815     .has_bias(false)
816     .input_size(15, 14)
817     .padding(1, 1)
818     .kernel_size(2, 2)
819     .groups(24)
820     .iterations(3)
821     .TestNHWCxQC8();
822 }
823 
824 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 3x3) {
825   ConvolutionOperatorTester()
826     .depthwise_layout(true)
827     .input_size(15, 14)
828     .padding(1, 1)
829     .kernel_size(3, 3)
830     .groups(24)
831     .iterations(3)
832     .TestNHWCxQC8();
833 }
834 
835 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 3x3_with_depth_multiplier) {
836   ConvolutionOperatorTester()
837     .depthwise_layout(true)
838     .input_size(15, 14)
839     .padding(1, 1)
840     .kernel_size(3, 3)
841     .groups(24)
842     .group_output_channels(3)
843     .iterations(3)
844     .TestNHWCxQC8();
845 }
846 
847 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 3x3_without_bias) {
848   ConvolutionOperatorTester()
849     .depthwise_layout(true)
850     .has_bias(false)
851     .input_size(15, 14)
852     .padding(1, 1)
853     .kernel_size(3, 3)
854     .groups(24)
855     .iterations(3)
856     .TestNHWCxQC8();
857 }
858 
859 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 3x3s2_with_tf_same_padding) {
860   for (size_t input_height = 14; input_height <= 15; input_height++) {
861     for (size_t input_width = 14; input_width <= 15; input_width++) {
862       ConvolutionOperatorTester()
863         .depthwise_layout(true)
864         .input_size(input_height, input_width)
865         .padding_tf_same(true)
866         .kernel_size(3, 3)
867         .groups(24)
868         .iterations(3)
869         .TestNHWCxQC8();
870     }
871   }
872 }
873 
874 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 5x5) {
875   ConvolutionOperatorTester()
876     .depthwise_layout(true)
877     .input_size(15, 14)
878     .padding(2, 2)
879     .kernel_size(5, 5)
880     .groups(24)
881     .iterations(3)
882     .TestNHWCxQC8();
883 }
884 
885 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 5x5_with_depth_multiplier) {
886   ConvolutionOperatorTester()
887     .depthwise_layout(true)
888     .input_size(15, 14)
889     .padding(2, 2)
890     .kernel_size(5, 5)
891     .groups(24)
892     .group_output_channels(3)
893     .iterations(3)
894     .TestNHWCxQC8();
895 }
896 
897 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 5x5_without_bias) {
898   ConvolutionOperatorTester()
899     .depthwise_layout(true)
900     .has_bias(false)
901     .input_size(15, 14)
902     .padding(2, 2)
903     .kernel_size(5, 5)
904     .groups(24)
905     .iterations(3)
906     .TestNHWCxQC8();
907 }
908 
909 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 7x7) {
910   ConvolutionOperatorTester()
911     .depthwise_layout(true)
912     .input_size(15, 14)
913     .padding(3, 3)
914     .kernel_size(7, 7)
915     .groups(24)
916     .iterations(3)
917     .TestNHWCxQC8();
918 }
919 
920 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, 7x7_without_bias) {
921   ConvolutionOperatorTester()
922     .depthwise_layout(true)
923     .has_bias(false)
924     .input_size(15, 14)
925     .padding(3, 3)
926     .kernel_size(7, 7)
927     .groups(24)
928     .iterations(3)
929     .TestNHWCxQC8();
930 }
931 
932 // Tests dwconv microkernel with weights cache.
TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8,weights_cache_1x1)933 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, weights_cache_1x1) {
934   ConvolutionOperatorTester()
935     .depthwise_layout(true)
936     .input_size(15, 14)
937     .kernel_size(1, 1)
938     .groups(24)
939     .use_weights_cache(true)
940     .iterations(3)
941     .TestNHWCxQC8();
942 }
943 
944 // Tests dwconv microkernek with non 1x1 kernel (dwconv_hwg packing).
TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8,weights_cache_2x2)945 TEST(DEPTHWISE_CONVOLUTION_NHWC_QC8, weights_cache_2x2) {
946   ConvolutionOperatorTester()
947     .depthwise_layout(true)
948     .input_size(15, 14)
949     .padding(1, 1)
950     .kernel_size(2, 2)
951     .groups(24)
952     .use_weights_cache(true)
953     .iterations(3)
954     .TestNHWCxQC8();
955 }
956 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_input_buffer)957 TEST(CONVOLUTION_NHWC_QC8, setup_changing_input_buffer) {
958   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
959   ConvolutionOperatorTester()
960     .batch_size(3)
961     .input_height(8)
962     .input_width(8)
963     .kernel_height(5)
964     .kernel_width(3)
965     .group_input_channels(15)
966     .group_output_channels(17)
967     .TestSetupNHWCxQC8();
968 }
969 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_input_buffer_grouped)970 TEST(CONVOLUTION_NHWC_QC8, setup_changing_input_buffer_grouped) {
971   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
972   ConvolutionOperatorTester()
973     .batch_size(3)
974     .input_height(8)
975     .input_width(8)
976     .kernel_height(5)
977     .kernel_width(3)
978     .groups(2)
979     .group_input_channels(15)
980     .group_output_channels(17)
981     .TestSetupNHWCxQC8();
982 }
983 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_input_buffer_depthwise)984 TEST(CONVOLUTION_NHWC_QC8, setup_changing_input_buffer_depthwise) {
985   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
986   ConvolutionOperatorTester()
987     .batch_size(3)
988     .input_height(8)
989     .input_width(8)
990     .kernel_height(3)
991     .kernel_width(3)
992     .groups(19)
993     .group_input_channels(1)
994     .group_output_channels(1)
995     .TestSetupNHWCxQC8();
996 }
997 
TEST(CONVOLUTION_NHWC_QC8,setup_increasing_batch)998 TEST(CONVOLUTION_NHWC_QC8, setup_increasing_batch) {
999   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1000   ConvolutionOperatorTester()
1001     .batch_size(3)
1002     .next_batch_size(5)
1003     .input_height(8)
1004     .input_width(8)
1005     .kernel_height(5)
1006     .kernel_width(3)
1007     .group_input_channels(15)
1008     .group_output_channels(17)
1009     .TestSetupNHWCxQC8();
1010 }
1011 
TEST(CONVOLUTION_NHWC_QC8,setup_increasing_batch_grouped)1012 TEST(CONVOLUTION_NHWC_QC8, setup_increasing_batch_grouped) {
1013   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1014   ConvolutionOperatorTester()
1015     .batch_size(3)
1016     .next_batch_size(5)
1017     .input_height(8)
1018     .input_width(8)
1019     .kernel_height(5)
1020     .kernel_width(3)
1021     .groups(2)
1022     .group_input_channels(15)
1023     .group_output_channels(17)
1024     .TestSetupNHWCxQC8();
1025 }
1026 
TEST(CONVOLUTION_NHWC_QC8,setup_increasing_batch_depthwise)1027 TEST(CONVOLUTION_NHWC_QC8, setup_increasing_batch_depthwise) {
1028   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1029   ConvolutionOperatorTester()
1030     .batch_size(3)
1031     .next_batch_size(5)
1032     .input_height(8)
1033     .input_width(8)
1034     .kernel_height(3)
1035     .kernel_width(3)
1036     .groups(19)
1037     .group_input_channels(1)
1038     .group_output_channels(1)
1039     .TestSetupNHWCxQC8();
1040 }
1041 
TEST(CONVOLUTION_NHWC_QC8,setup_decreasing_batch)1042 TEST(CONVOLUTION_NHWC_QC8, setup_decreasing_batch) {
1043   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1044   ConvolutionOperatorTester()
1045     .batch_size(5)
1046     .next_batch_size(3)
1047     .input_height(8)
1048     .input_width(8)
1049     .kernel_height(5)
1050     .kernel_width(3)
1051     .group_input_channels(15)
1052     .group_output_channels(17)
1053     .TestSetupNHWCxQC8();
1054 }
1055 
TEST(CONVOLUTION_NHWC_QC8,setup_decreasing_batch_grouped)1056 TEST(CONVOLUTION_NHWC_QC8, setup_decreasing_batch_grouped) {
1057   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1058   ConvolutionOperatorTester()
1059     .batch_size(5)
1060     .next_batch_size(3)
1061     .input_height(8)
1062     .input_width(8)
1063     .kernel_height(5)
1064     .kernel_width(3)
1065     .groups(2)
1066     .group_input_channels(15)
1067     .group_output_channels(17)
1068     .TestSetupNHWCxQC8();
1069 }
1070 
TEST(CONVOLUTION_NHWC_QC8,setup_decreasing_batch_depthwise)1071 TEST(CONVOLUTION_NHWC_QC8, setup_decreasing_batch_depthwise) {
1072   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1073   ConvolutionOperatorTester()
1074     .batch_size(5)
1075     .next_batch_size(3)
1076     .input_height(8)
1077     .input_width(8)
1078     .kernel_height(3)
1079     .kernel_width(3)
1080     .groups(19)
1081     .group_input_channels(1)
1082     .group_output_channels(1)
1083     .TestSetupNHWCxQC8();
1084 }
1085 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_height)1086 TEST(CONVOLUTION_NHWC_QC8, setup_changing_height) {
1087   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1088   ConvolutionOperatorTester()
1089     .batch_size(3)
1090     .input_height(8)
1091     .input_width(8)
1092     .next_input_height(9)
1093     .kernel_height(5)
1094     .kernel_width(3)
1095     .group_input_channels(15)
1096     .group_output_channels(17)
1097     .TestSetupNHWCxQC8();
1098   ConvolutionOperatorTester()
1099     .batch_size(3)
1100     .input_height(8)
1101     .input_width(8)
1102     .next_input_height(7)
1103     .kernel_height(5)
1104     .kernel_width(3)
1105     .group_input_channels(15)
1106     .group_output_channels(17)
1107     .TestSetupNHWCxQC8();
1108 }
1109 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_height_grouped)1110 TEST(CONVOLUTION_NHWC_QC8, setup_changing_height_grouped) {
1111   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1112   ConvolutionOperatorTester()
1113     .batch_size(3)
1114     .input_height(8)
1115     .input_width(8)
1116     .next_input_height(9)
1117     .kernel_height(5)
1118     .kernel_width(3)
1119     .groups(2)
1120     .group_input_channels(15)
1121     .group_output_channels(17)
1122     .TestSetupNHWCxQC8();
1123   ConvolutionOperatorTester()
1124     .batch_size(3)
1125     .input_height(8)
1126     .input_width(8)
1127     .next_input_height(7)
1128     .kernel_height(5)
1129     .kernel_width(3)
1130     .groups(2)
1131     .group_input_channels(15)
1132     .group_output_channels(17)
1133     .TestSetupNHWCxQC8();
1134 }
1135 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_height_depthwise)1136 TEST(CONVOLUTION_NHWC_QC8, setup_changing_height_depthwise) {
1137   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1138   ConvolutionOperatorTester()
1139     .batch_size(3)
1140     .input_height(8)
1141     .input_width(8)
1142     .next_input_height(9)
1143     .kernel_height(3)
1144     .kernel_width(3)
1145     .groups(19)
1146     .group_input_channels(1)
1147     .group_output_channels(1)
1148     .TestSetupNHWCxQC8();
1149   ConvolutionOperatorTester()
1150     .batch_size(3)
1151     .input_height(8)
1152     .input_width(8)
1153     .next_input_height(7)
1154     .kernel_height(3)
1155     .kernel_width(3)
1156     .groups(19)
1157     .group_input_channels(1)
1158     .group_output_channels(1)
1159     .TestSetupNHWCxQC8();
1160 }
1161 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_width)1162 TEST(CONVOLUTION_NHWC_QC8, setup_changing_width) {
1163   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1164   ConvolutionOperatorTester()
1165     .batch_size(3)
1166     .input_height(8)
1167     .input_width(8)
1168     .next_input_width(9)
1169     .kernel_height(5)
1170     .kernel_width(3)
1171     .group_input_channels(15)
1172     .group_output_channels(17)
1173     .TestSetupNHWCxQC8();
1174   ConvolutionOperatorTester()
1175     .batch_size(3)
1176     .input_height(8)
1177     .input_width(8)
1178     .next_input_width(7)
1179     .kernel_height(5)
1180     .kernel_width(3)
1181     .group_input_channels(15)
1182     .group_output_channels(17)
1183     .TestSetupNHWCxQC8();
1184 }
1185 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_width_grouped)1186 TEST(CONVOLUTION_NHWC_QC8, setup_changing_width_grouped) {
1187   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1188   ConvolutionOperatorTester()
1189     .batch_size(3)
1190     .input_height(8)
1191     .input_width(8)
1192     .next_input_width(9)
1193     .kernel_height(5)
1194     .kernel_width(3)
1195     .groups(2)
1196     .group_input_channels(15)
1197     .group_output_channels(17)
1198     .TestSetupNHWCxQC8();
1199   ConvolutionOperatorTester()
1200     .batch_size(3)
1201     .input_height(8)
1202     .input_width(8)
1203     .next_input_width(7)
1204     .kernel_height(5)
1205     .kernel_width(3)
1206     .groups(2)
1207     .group_input_channels(15)
1208     .group_output_channels(17)
1209     .TestSetupNHWCxQC8();
1210 }
1211 
TEST(CONVOLUTION_NHWC_QC8,setup_changing_width_depthwise)1212 TEST(CONVOLUTION_NHWC_QC8, setup_changing_width_depthwise) {
1213   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1214   ConvolutionOperatorTester()
1215     .batch_size(3)
1216     .input_height(8)
1217     .input_width(8)
1218     .next_input_width(9)
1219     .kernel_height(3)
1220     .kernel_width(3)
1221     .groups(19)
1222     .group_input_channels(1)
1223     .group_output_channels(1)
1224     .TestSetupNHWCxQC8();
1225   ConvolutionOperatorTester()
1226     .batch_size(3)
1227     .input_height(8)
1228     .input_width(8)
1229     .next_input_width(7)
1230     .kernel_height(3)
1231     .kernel_width(3)
1232     .groups(19)
1233     .group_input_channels(1)
1234     .group_output_channels(1)
1235     .TestSetupNHWCxQC8();
1236 }
1237 
TEST(CONVOLUTION_NHWC_QC8,setup_swap_height_and_width)1238 TEST(CONVOLUTION_NHWC_QC8, setup_swap_height_and_width) {
1239   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1240   ConvolutionOperatorTester()
1241     .batch_size(3)
1242     .input_height(9)
1243     .input_width(8)
1244     .next_input_height(8)
1245     .next_input_width(9)
1246     .kernel_height(5)
1247     .kernel_width(3)
1248     .group_input_channels(15)
1249     .group_output_channels(17)
1250     .TestSetupNHWCxQC8();
1251 }
1252 
TEST(CONVOLUTION_NHWC_QC8,setup_swap_height_and_width_grouped)1253 TEST(CONVOLUTION_NHWC_QC8, setup_swap_height_and_width_grouped) {
1254   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1255   ConvolutionOperatorTester()
1256     .batch_size(3)
1257     .input_height(9)
1258     .input_width(8)
1259     .next_input_height(8)
1260     .next_input_width(9)
1261     .kernel_height(5)
1262     .kernel_width(3)
1263     .groups(2)
1264     .group_input_channels(15)
1265     .group_output_channels(17)
1266     .TestSetupNHWCxQC8();
1267 }
1268 
TEST(CONVOLUTION_NHWC_QC8,setup_swap_height_and_width_depthwise)1269 TEST(CONVOLUTION_NHWC_QC8, setup_swap_height_and_width_depthwise) {
1270   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1271   ConvolutionOperatorTester()
1272     .batch_size(3)
1273     .input_height(9)
1274     .input_width(8)
1275     .next_input_height(8)
1276     .next_input_width(9)
1277     .kernel_height(3)
1278     .kernel_width(3)
1279     .groups(19)
1280     .group_input_channels(1)
1281     .group_output_channels(1)
1282     .TestSetupNHWCxQC8();
1283 }
1284 
1285 
1286 TEST(CONVOLUTION_NHWC_QS8, 1x1) {
1287   ConvolutionOperatorTester()
1288     .input_size(27, 29)
1289     .kernel_size(1, 1)
1290     .group_input_channels(23)
1291     .group_output_channels(19)
1292     .iterations(3)
1293     .TestNHWCxQS8();
1294 }
1295 
1296 TEST(CONVOLUTION_NHWC_QS8, 1x1_with_qmin) {
1297   ConvolutionOperatorTester()
1298     .input_size(27, 29)
1299     .kernel_size(1, 1)
1300     .group_input_channels(23)
1301     .group_output_channels(19)
1302     .qmin(128)
1303     .iterations(3)
1304     .TestNHWCxQS8();
1305 }
1306 
1307 TEST(CONVOLUTION_NHWC_QS8, 1x1_with_qmax) {
1308   ConvolutionOperatorTester()
1309     .input_size(27, 29)
1310     .kernel_size(1, 1)
1311     .group_input_channels(23)
1312     .group_output_channels(19)
1313     .qmax(128)
1314     .iterations(3)
1315     .TestNHWCxQS8();
1316 }
1317 
1318 TEST(CONVOLUTION_NHWC_QS8, 1x1_with_input_stride) {
1319   ConvolutionOperatorTester()
1320     .input_size(27, 29)
1321     .kernel_size(1, 1)
1322     .input_channel_stride(28)
1323     .group_input_channels(23)
1324     .group_output_channels(19)
1325     .iterations(3)
1326     .TestNHWCxQS8();
1327 }
1328 
1329 TEST(CONVOLUTION_NHWC_QS8, 1x1_with_output_stride) {
1330   ConvolutionOperatorTester()
1331     .input_size(27, 29)
1332     .kernel_size(1, 1)
1333     .output_channel_stride(29)
1334     .group_input_channels(23)
1335     .group_output_channels(19)
1336     .iterations(3)
1337     .TestNHWCxQS8();
1338 }
1339 
1340 TEST(CONVOLUTION_NHWC_QS8, 1x1_without_bias) {
1341   ConvolutionOperatorTester()
1342     .has_bias(false)
1343     .input_size(13, 14)
1344     .kernel_size(1, 1)
1345     .group_input_channels(23)
1346     .group_output_channels(19)
1347     .iterations(3)
1348     .TestNHWCxQS8();
1349 }
1350 
1351 TEST(CONVOLUTION_NHWC_QS8, 1x1_with_batch) {
1352   ConvolutionOperatorTester()
1353     .batch_size(3)
1354     .input_size(13, 14)
1355     .kernel_size(1, 1)
1356     .group_input_channels(23)
1357     .group_output_channels(19)
1358     .iterations(3)
1359     .TestNHWCxQS8();
1360 }
1361 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1)1362 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1) {
1363   ConvolutionOperatorTester()
1364     .input_size(24, 25)
1365     .kernel_size(1, 1)
1366     .groups(2)
1367     .group_input_channels(17)
1368     .group_output_channels(19)
1369     .iterations(3)
1370     .TestNHWCxQS8();
1371 }
1372 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1_with_qmin)1373 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1_with_qmin) {
1374   ConvolutionOperatorTester()
1375     .input_size(24, 25)
1376     .kernel_size(1, 1)
1377     .groups(2)
1378     .group_input_channels(17)
1379     .group_output_channels(19)
1380     .qmin(128)
1381     .iterations(3)
1382     .TestNHWCxQS8();
1383 }
1384 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1_with_qmax)1385 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1_with_qmax) {
1386   ConvolutionOperatorTester()
1387     .input_size(24, 25)
1388     .kernel_size(1, 1)
1389     .groups(2)
1390     .group_input_channels(17)
1391     .group_output_channels(19)
1392     .qmax(128)
1393     .iterations(3)
1394     .TestNHWCxQS8();
1395 }
1396 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1_with_input_stride)1397 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1_with_input_stride) {
1398   ConvolutionOperatorTester()
1399     .input_size(24, 25)
1400     .kernel_size(1, 1)
1401     .groups(2)
1402     .input_channel_stride(37)
1403     .group_input_channels(17)
1404     .group_output_channels(19)
1405     .iterations(3)
1406     .TestNHWCxQS8();
1407 }
1408 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1_with_output_stride)1409 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1_with_output_stride) {
1410   ConvolutionOperatorTester()
1411     .input_size(24, 25)
1412     .kernel_size(1, 1)
1413     .groups(2)
1414     .output_channel_stride(41)
1415     .group_input_channels(17)
1416     .group_output_channels(19)
1417     .iterations(3)
1418     .TestNHWCxQS8();
1419 }
1420 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1_without_bias)1421 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1_without_bias) {
1422   ConvolutionOperatorTester()
1423     .has_bias(false)
1424     .input_size(24, 25)
1425     .kernel_size(1, 1)
1426     .groups(2)
1427     .group_input_channels(17)
1428     .group_output_channels(19)
1429     .iterations(3)
1430     .TestNHWCxQS8();
1431 }
1432 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x1_with_batch)1433 TEST(CONVOLUTION_NHWC_QS8, grouped_1x1_with_batch) {
1434   ConvolutionOperatorTester()
1435     .batch_size(3)
1436     .input_size(24, 25)
1437     .kernel_size(1, 1)
1438     .groups(2)
1439     .group_input_channels(17)
1440     .group_output_channels(19)
1441     .iterations(3)
1442     .TestNHWCxQS8();
1443 }
1444 
1445 TEST(CONVOLUTION_NHWC_QS8, 1x3) {
1446   ConvolutionOperatorTester()
1447     .input_size(20, 19)
1448     .padding_width(1)
1449     .kernel_size(1, 3)
1450     .group_input_channels(17)
1451     .group_output_channels(15)
1452     .iterations(3)
1453     .TestNHWCxQS8();
1454 }
1455 
TEST(CONVOLUTION_NHWC_QS8,grouped_1x3)1456 TEST(CONVOLUTION_NHWC_QS8, grouped_1x3) {
1457   ConvolutionOperatorTester()
1458     .input_size(20, 19)
1459     .padding_width(1)
1460     .kernel_size(1, 3)
1461     .groups(2)
1462     .group_input_channels(17)
1463     .group_output_channels(15)
1464     .iterations(3)
1465     .TestNHWCxQS8();
1466 }
1467 
1468 TEST(CONVOLUTION_NHWC_QS8, 3x1) {
1469   ConvolutionOperatorTester()
1470     .input_size(19, 20)
1471     .padding_height(1)
1472     .kernel_size(3, 1)
1473     .group_input_channels(17)
1474     .group_output_channels(15)
1475     .iterations(3)
1476     .TestNHWCxQS8();
1477 }
1478 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x1)1479 TEST(CONVOLUTION_NHWC_QS8, grouped_3x1) {
1480   ConvolutionOperatorTester()
1481     .input_size(19, 20)
1482     .padding_height(1)
1483     .kernel_size(3, 1)
1484     .groups(2)
1485     .group_input_channels(17)
1486     .group_output_channels(15)
1487     .iterations(3)
1488     .TestNHWCxQS8();
1489 }
1490 
1491 TEST(CONVOLUTION_NHWC_QS8, 3x3) {
1492   ConvolutionOperatorTester()
1493     .input_size(13, 12)
1494     .padding(1)
1495     .kernel_size(3, 3)
1496     .group_input_channels(15)
1497     .group_output_channels(17)
1498     .iterations(3)
1499     .TestNHWCxQS8();
1500 }
1501 
1502 TEST(CONVOLUTION_NHWC_QS8, 3x3_without_padding) {
1503   ConvolutionOperatorTester()
1504     .input_size(13, 12)
1505     .kernel_size(3, 3)
1506     .group_input_channels(15)
1507     .group_output_channels(17)
1508     .iterations(3)
1509     .TestNHWCxQS8();
1510 }
1511 
1512 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_left_padding) {
1513   ConvolutionOperatorTester()
1514     .input_size(13, 12)
1515     .padding_left(1)
1516     .kernel_size(3, 3)
1517     .group_input_channels(15)
1518     .group_output_channels(17)
1519     .iterations(3)
1520     .TestNHWCxQS8();
1521 }
1522 
1523 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_right_padding) {
1524   ConvolutionOperatorTester()
1525     .input_size(13, 12)
1526     .padding_right(1)
1527     .kernel_size(3, 3)
1528     .group_input_channels(15)
1529     .group_output_channels(17)
1530     .iterations(3)
1531     .TestNHWCxQS8();
1532 }
1533 
1534 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_top_padding) {
1535   ConvolutionOperatorTester()
1536     .input_size(13, 12)
1537     .padding_top(1)
1538     .kernel_size(3, 3)
1539     .group_input_channels(15)
1540     .group_output_channels(17)
1541     .iterations(3)
1542     .TestNHWCxQS8();
1543 }
1544 
1545 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_bottom_padding) {
1546   ConvolutionOperatorTester()
1547     .input_size(13, 12)
1548     .padding_bottom(1)
1549     .kernel_size(3, 3)
1550     .group_input_channels(15)
1551     .group_output_channels(17)
1552     .iterations(3)
1553     .TestNHWCxQS8();
1554 }
1555 
1556 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_input_stride) {
1557   ConvolutionOperatorTester()
1558     .input_size(13, 12)
1559     .padding(1)
1560     .kernel_size(3, 3)
1561     .input_channel_stride(22)
1562     .group_input_channels(15)
1563     .group_output_channels(17)
1564     .iterations(3)
1565     .TestNHWCxQS8();
1566 }
1567 
1568 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_output_stride) {
1569   ConvolutionOperatorTester()
1570     .input_size(13, 12)
1571     .padding(1)
1572     .kernel_size(3, 3)
1573     .output_channel_stride(23)
1574     .group_input_channels(15)
1575     .group_output_channels(17)
1576     .iterations(3)
1577     .TestNHWCxQS8();
1578 }
1579 
1580 TEST(CONVOLUTION_NHWC_QS8, 3x3_without_bias) {
1581   ConvolutionOperatorTester()
1582     .has_bias(false)
1583     .input_size(10, 9)
1584     .padding(1)
1585     .kernel_size(3, 3)
1586     .group_input_channels(15)
1587     .group_output_channels(17)
1588     .iterations(3)
1589     .TestNHWCxQS8();
1590 }
1591 
1592 TEST(CONVOLUTION_NHWC_QS8, 3x3_with_batch) {
1593   ConvolutionOperatorTester()
1594     .batch_size(3)
1595     .input_size(10, 9)
1596     .padding(1)
1597     .kernel_size(3, 3)
1598     .group_input_channels(15)
1599     .group_output_channels(17)
1600     .iterations(3)
1601     .TestNHWCxQS8();
1602 }
1603 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3)1604 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3) {
1605   ConvolutionOperatorTester()
1606     .input_size(10, 11)
1607     .padding(1)
1608     .kernel_size(3, 3)
1609     .groups(2)
1610     .group_input_channels(14)
1611     .group_output_channels(13)
1612     .iterations(3)
1613     .TestNHWCxQS8();
1614 }
1615 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_without_padding)1616 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_without_padding) {
1617   ConvolutionOperatorTester()
1618     .input_size(13, 12)
1619     .kernel_size(3, 3)
1620     .group_input_channels(15)
1621     .group_output_channels(17)
1622     .iterations(3)
1623     .TestNHWCxQS8();
1624 }
1625 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_left_padding)1626 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_left_padding) {
1627   ConvolutionOperatorTester()
1628     .input_size(10, 11)
1629     .padding_left(1)
1630     .kernel_size(3, 3)
1631     .groups(2)
1632     .group_input_channels(14)
1633     .group_output_channels(13)
1634     .iterations(3)
1635     .TestNHWCxQS8();
1636 }
1637 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_right_padding)1638 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_right_padding) {
1639   ConvolutionOperatorTester()
1640     .input_size(10, 11)
1641     .padding_right(1)
1642     .kernel_size(3, 3)
1643     .groups(2)
1644     .group_input_channels(14)
1645     .group_output_channels(13)
1646     .iterations(3)
1647     .TestNHWCxQS8();
1648 }
1649 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_top_padding)1650 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_top_padding) {
1651   ConvolutionOperatorTester()
1652     .input_size(10, 11)
1653     .padding_top(1)
1654     .kernel_size(3, 3)
1655     .groups(2)
1656     .group_input_channels(14)
1657     .group_output_channels(13)
1658     .iterations(3)
1659     .TestNHWCxQS8();
1660 }
1661 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_bottom_padding)1662 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_bottom_padding) {
1663   ConvolutionOperatorTester()
1664     .input_size(10, 11)
1665     .padding_bottom(1)
1666     .kernel_size(3, 3)
1667     .groups(2)
1668     .group_input_channels(14)
1669     .group_output_channels(13)
1670     .iterations(3)
1671     .TestNHWCxQS8();
1672 }
1673 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_input_stride)1674 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_input_stride) {
1675   ConvolutionOperatorTester()
1676     .input_size(10, 11)
1677     .padding(1)
1678     .kernel_size(3, 3)
1679     .groups(2)
1680     .input_channel_stride(29)
1681     .group_input_channels(14)
1682     .group_output_channels(13)
1683     .iterations(3)
1684     .TestNHWCxQS8();
1685 }
1686 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_output_stride)1687 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_output_stride) {
1688   ConvolutionOperatorTester()
1689     .input_size(10, 11)
1690     .padding(1)
1691     .kernel_size(3, 3)
1692     .groups(2)
1693     .output_channel_stride(31)
1694     .group_input_channels(14)
1695     .group_output_channels(13)
1696     .iterations(3)
1697     .TestNHWCxQS8();
1698 }
1699 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_without_bias)1700 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_without_bias) {
1701   ConvolutionOperatorTester()
1702     .has_bias(false)
1703     .input_size(10, 11)
1704     .padding(1)
1705     .kernel_size(3, 3)
1706     .groups(2)
1707     .group_input_channels(14)
1708     .group_output_channels(13)
1709     .iterations(3)
1710     .TestNHWCxQS8();
1711 }
1712 
TEST(CONVOLUTION_NHWC_QS8,grouped_3x3_with_batch)1713 TEST(CONVOLUTION_NHWC_QS8, grouped_3x3_with_batch) {
1714   ConvolutionOperatorTester()
1715     .batch_size(3)
1716     .input_size(10, 11)
1717     .padding(1)
1718     .kernel_size(3, 3)
1719     .groups(2)
1720     .group_input_channels(14)
1721     .group_output_channels(13)
1722     .iterations(3)
1723     .TestNHWCxQS8();
1724 }
1725 
1726 TEST(CONVOLUTION_NHWC_QS8, 3x3s2) {
1727   ConvolutionOperatorTester()
1728     .input_size(14, 13)
1729     .padding(1)
1730     .kernel_size(3, 3)
1731     .subsampling(2)
1732     .group_input_channels(27)
1733     .group_output_channels(19)
1734     .iterations(3)
1735     .TestNHWCxQS8();
1736 }
1737 
1738 TEST(CONVOLUTION_NHWC_QS8, 3x3s2_with_tf_same_padding) {
1739   for (size_t input_height = 13; input_height <= 14; input_height++) {
1740     for (size_t input_width = 13; input_width <= 14; input_width++) {
1741       ConvolutionOperatorTester()
1742         .input_size(input_height, input_width)
1743         .padding_tf_same(true)
1744         .kernel_size(3, 3)
1745         .subsampling(2)
1746         .group_input_channels(27)
1747         .group_output_channels(19)
1748         .iterations(3)
1749         .TestNHWCxQS8();
1750     }
1751   }
1752 }
1753 
1754 TEST(CONVOLUTION_NHWC_QS8, 3x3s1x2) {
1755   ConvolutionOperatorTester()
1756     .input_size(14, 13)
1757     .padding(1)
1758     .kernel_size(3, 3)
1759     .subsampling(1, 2)
1760     .group_input_channels(27)
1761     .group_output_channels(19)
1762     .iterations(3)
1763     .TestNHWCxQS8();
1764 }
1765 
1766 TEST(CONVOLUTION_NHWC_QS8, 3x3s1x2_with_tf_same_padding) {
1767   for (size_t input_height = 13; input_height <= 14; input_height++) {
1768     for (size_t input_width = 13; input_width <= 14; input_width++) {
1769       ConvolutionOperatorTester()
1770         .input_size(input_height, input_width)
1771         .padding_tf_same(true)
1772         .kernel_size(3, 3)
1773         .subsampling(1, 2)
1774         .group_input_channels(27)
1775         .group_output_channels(19)
1776         .iterations(3)
1777         .TestNHWCxQS8();
1778     }
1779   }
1780 }
1781 
1782 TEST(CONVOLUTION_NHWC_QS8, 3x3s2x1) {
1783   ConvolutionOperatorTester()
1784     .input_size(14, 13)
1785     .padding(1)
1786     .kernel_size(3, 3)
1787     .subsampling(2, 1)
1788     .group_input_channels(27)
1789     .group_output_channels(19)
1790     .iterations(3)
1791     .TestNHWCxQS8();
1792 }
1793 
1794 TEST(CONVOLUTION_NHWC_QS8, 3x3s2x1_with_tf_same_padding) {
1795   for (size_t input_height = 13; input_height <= 14; input_height++) {
1796     for (size_t input_width = 13; input_width <= 14; input_width++) {
1797       ConvolutionOperatorTester()
1798         .input_size(input_height, input_width)
1799         .padding_tf_same(true)
1800         .kernel_size(3, 3)
1801         .subsampling(2, 1)
1802         .group_input_channels(27)
1803         .group_output_channels(19)
1804         .iterations(3)
1805         .TestNHWCxQS8();
1806     }
1807   }
1808 }
1809 
1810 TEST(CONVOLUTION_NHWC_QS8, 3x3d2) {
1811   ConvolutionOperatorTester()
1812     .input_size(14, 13)
1813     .padding(2)
1814     .kernel_size(3, 3)
1815     .dilation(2)
1816     .group_input_channels(27)
1817     .group_output_channels(19)
1818     .iterations(3)
1819     .TestNHWCxQS8();
1820 }
1821 
1822 TEST(CONVOLUTION_NHWC_QS8, 3x3d1x2) {
1823   ConvolutionOperatorTester()
1824     .input_size(14, 13)
1825     .padding(1, 2)
1826     .kernel_size(3, 3)
1827     .dilation(1, 2)
1828     .group_input_channels(27)
1829     .group_output_channels(19)
1830     .iterations(3)
1831     .TestNHWCxQS8();
1832 }
1833 
1834 TEST(CONVOLUTION_NHWC_QS8, 3x3d2x1) {
1835   ConvolutionOperatorTester()
1836     .input_size(14, 13)
1837     .padding(2, 1)
1838     .kernel_size(3, 3)
1839     .dilation(2, 1)
1840     .group_input_channels(27)
1841     .group_output_channels(19)
1842     .iterations(3)
1843     .TestNHWCxQS8();
1844 }
1845 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3)1846 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3) {
1847   ConvolutionOperatorTester()
1848     .input_size(15, 14)
1849     .padding(1, 1)
1850     .kernel_size(3, 3)
1851     .groups(27)
1852     .iterations(3)
1853     .TestNHWCxQS8();
1854 }
1855 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3_without_bias)1856 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3_without_bias) {
1857   ConvolutionOperatorTester()
1858     .has_bias(false)
1859     .input_size(15, 14)
1860     .padding(1, 1)
1861     .kernel_size(3, 3)
1862     .groups(27)
1863     .iterations(3)
1864     .TestNHWCxQS8();
1865 }
1866 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3s2)1867 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3s2) {
1868   ConvolutionOperatorTester()
1869     .input_size(15, 14)
1870     .padding(1, 1)
1871     .kernel_size(3, 3)
1872     .subsampling(2)
1873     .groups(27)
1874     .iterations(3)
1875     .TestNHWCxQS8();
1876 }
1877 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3s2_with_tf_same_padding)1878 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3s2_with_tf_same_padding) {
1879   for (size_t input_height = 14; input_height <= 15; input_height++) {
1880     for (size_t input_width = 14; input_width <= 15; input_width++) {
1881       ConvolutionOperatorTester()
1882         .input_size(input_height, input_width)
1883         .padding_tf_same(true)
1884         .kernel_size(3, 3)
1885         .subsampling(2)
1886         .groups(27)
1887         .iterations(3)
1888         .TestNHWCxQS8();
1889     }
1890   }
1891 }
1892 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3s1x2)1893 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3s1x2) {
1894   ConvolutionOperatorTester()
1895     .input_size(15, 14)
1896     .padding(1, 1)
1897     .kernel_size(3, 3)
1898     .subsampling(1, 2)
1899     .groups(27)
1900     .iterations(3)
1901     .TestNHWCxQS8();
1902 }
1903 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3s1x2_with_tf_same_padding)1904 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3s1x2_with_tf_same_padding) {
1905   for (size_t input_height = 14; input_height <= 15; input_height++) {
1906     for (size_t input_width = 14; input_width <= 15; input_width++) {
1907       ConvolutionOperatorTester()
1908         .input_size(input_height, input_width)
1909         .padding_tf_same(true)
1910         .kernel_size(3, 3)
1911         .subsampling(1, 2)
1912         .groups(27)
1913         .iterations(3)
1914         .TestNHWCxQS8();
1915     }
1916   }
1917 }
1918 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3s2x1)1919 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3s2x1) {
1920   ConvolutionOperatorTester()
1921     .input_size(15, 14)
1922     .padding(1, 1)
1923     .kernel_size(3, 3)
1924     .subsampling(2, 1)
1925     .groups(27)
1926     .iterations(3)
1927     .TestNHWCxQS8();
1928 }
1929 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3s2x1_with_tf_same_padding)1930 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3s2x1_with_tf_same_padding) {
1931   for (size_t input_height = 14; input_height <= 15; input_height++) {
1932     for (size_t input_width = 14; input_width <= 15; input_width++) {
1933       ConvolutionOperatorTester()
1934         .input_size(input_height, input_width)
1935         .padding_tf_same(true)
1936         .kernel_size(3, 3)
1937         .subsampling(2, 1)
1938         .groups(27)
1939         .iterations(3)
1940         .TestNHWCxQS8();
1941     }
1942   }
1943 }
1944 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3d2)1945 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3d2) {
1946   ConvolutionOperatorTester()
1947     .input_size(15, 14)
1948     .padding(1, 1)
1949     .kernel_size(3, 3)
1950     .dilation(2)
1951     .groups(27)
1952     .iterations(3)
1953     .TestNHWCxQS8();
1954 }
1955 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3d1x2)1956 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3d1x2) {
1957   ConvolutionOperatorTester()
1958     .input_size(15, 14)
1959     .padding(1, 1)
1960     .kernel_size(3, 3)
1961     .dilation(1, 2)
1962     .groups(27)
1963     .iterations(3)
1964     .TestNHWCxQS8();
1965 }
1966 
TEST(CONVOLUTION_NHWC_QS8,depthwise_3x3d2x1)1967 TEST(CONVOLUTION_NHWC_QS8, depthwise_3x3d2x1) {
1968   ConvolutionOperatorTester()
1969     .input_size(15, 14)
1970     .padding(1, 1)
1971     .kernel_size(3, 3)
1972     .dilation(2, 1)
1973     .groups(27)
1974     .iterations(3)
1975     .TestNHWCxQS8();
1976 }
1977 
1978 // Tests GEMM microkernel with weights_cache.
TEST(CONVOLUTION_NHWC_QS8,weights_cache_1x1)1979 TEST(CONVOLUTION_NHWC_QS8, weights_cache_1x1) {
1980   ConvolutionOperatorTester()
1981     .input_size(27, 29)
1982     .kernel_size(1, 1)
1983     .group_input_channels(23)
1984     .group_output_channels(19)
1985     .use_weights_cache(true)
1986     .iterations(3)
1987     .TestNHWCxQS8();
1988 }
1989 
1990 // Tests IGEMM microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QS8,weights_cache_3x3)1991 TEST(CONVOLUTION_NHWC_QS8, weights_cache_3x3) {
1992   ConvolutionOperatorTester()
1993     .input_size(13, 12)
1994     .padding(1)
1995     .kernel_size(3, 3)
1996     .group_input_channels(15)
1997     .group_output_channels(17)
1998     .use_weights_cache(true)
1999     .iterations(3)
2000     .TestNHWCxQS8();
2001 }
2002 
2003 // Tests vmulcaddc microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QS8,weights_cache_depthwise_1x1)2004 TEST(CONVOLUTION_NHWC_QS8, weights_cache_depthwise_1x1) {
2005   ConvolutionOperatorTester()
2006     .input_size(15, 14)
2007     .kernel_size(1, 1)
2008     .groups(24)
2009     .use_weights_cache(true)
2010     .iterations(3)
2011     .TestNHWCxQS8();
2012 }
2013 
2014 // Tests dwconv microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QS8,weights_cache_depthwise_2x2d2)2015 TEST(CONVOLUTION_NHWC_QS8, weights_cache_depthwise_2x2d2) {
2016   ConvolutionOperatorTester()
2017     .input_size(15, 14)
2018     .padding(1, 1)
2019     .kernel_size(2, 2)
2020     .dilation(2)
2021     .groups(27)
2022     .iterations(3)
2023     .use_weights_cache(true)
2024     .TestNHWCxQS8();
2025 }
2026 
2027 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 1x1) {
2028   ConvolutionOperatorTester()
2029     .depthwise_layout(true)
2030     .input_size(15, 14)
2031     .kernel_size(1, 1)
2032     .groups(24)
2033     .iterations(3)
2034     .TestNHWCxQS8();
2035 }
2036 
2037 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 1x1_with_depth_multiplier) {
2038   ConvolutionOperatorTester()
2039     .depthwise_layout(true)
2040     .input_size(15, 14)
2041     .kernel_size(1, 1)
2042     .groups(24)
2043     .group_output_channels(3)
2044     .iterations(3)
2045     .TestNHWCxQS8();
2046 }
2047 
2048 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 1x1_without_bias) {
2049   ConvolutionOperatorTester()
2050     .depthwise_layout(true)
2051     .has_bias(false)
2052     .input_size(15, 14)
2053     .kernel_size(1, 1)
2054     .groups(24)
2055     .iterations(3)
2056     .TestNHWCxQS8();
2057 }
2058 
2059 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 2x2) {
2060   ConvolutionOperatorTester()
2061     .depthwise_layout(true)
2062     .input_size(15, 14)
2063     .padding(1, 1)
2064     .kernel_size(2, 2)
2065     .groups(24)
2066     .iterations(3)
2067     .TestNHWCxQS8();
2068 }
2069 
2070 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 2x2_with_depth_multiplier) {
2071   ConvolutionOperatorTester()
2072     .depthwise_layout(true)
2073     .input_size(15, 14)
2074     .padding(1, 1)
2075     .kernel_size(2, 2)
2076     .groups(24)
2077     .group_output_channels(3)
2078     .iterations(3)
2079     .TestNHWCxQS8();
2080 }
2081 
2082 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 2x2_without_bias) {
2083   ConvolutionOperatorTester()
2084     .depthwise_layout(true)
2085     .has_bias(false)
2086     .input_size(15, 14)
2087     .padding(1, 1)
2088     .kernel_size(2, 2)
2089     .groups(24)
2090     .iterations(3)
2091     .TestNHWCxQS8();
2092 }
2093 
2094 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 3x3) {
2095   ConvolutionOperatorTester()
2096     .depthwise_layout(true)
2097     .input_size(15, 14)
2098     .padding(1, 1)
2099     .kernel_size(3, 3)
2100     .groups(24)
2101     .iterations(3)
2102     .TestNHWCxQS8();
2103 }
2104 
2105 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 3x3_with_depth_multiplier) {
2106   ConvolutionOperatorTester()
2107     .depthwise_layout(true)
2108     .input_size(15, 14)
2109     .padding(1, 1)
2110     .kernel_size(3, 3)
2111     .groups(24)
2112     .group_output_channels(3)
2113     .iterations(3)
2114     .TestNHWCxQS8();
2115 }
2116 
2117 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 3x3_without_bias) {
2118   ConvolutionOperatorTester()
2119     .depthwise_layout(true)
2120     .has_bias(false)
2121     .input_size(15, 14)
2122     .padding(1, 1)
2123     .kernel_size(3, 3)
2124     .groups(24)
2125     .iterations(3)
2126     .TestNHWCxQS8();
2127 }
2128 
2129 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 3x3s2_with_tf_same_padding) {
2130   for (size_t input_height = 14; input_height <= 15; input_height++) {
2131     for (size_t input_width = 14; input_width <= 15; input_width++) {
2132       ConvolutionOperatorTester()
2133         .depthwise_layout(true)
2134         .input_size(input_height, input_width)
2135         .padding_tf_same(true)
2136         .kernel_size(3, 3)
2137         .groups(24)
2138         .iterations(3)
2139         .TestNHWCxQS8();
2140     }
2141   }
2142 }
2143 
2144 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 5x5) {
2145   ConvolutionOperatorTester()
2146     .depthwise_layout(true)
2147     .input_size(15, 14)
2148     .padding(2, 2)
2149     .kernel_size(5, 5)
2150     .groups(24)
2151     .iterations(3)
2152     .TestNHWCxQS8();
2153 }
2154 
2155 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 5x5_with_depth_multiplier) {
2156   ConvolutionOperatorTester()
2157     .depthwise_layout(true)
2158     .input_size(15, 14)
2159     .padding(2, 2)
2160     .kernel_size(5, 5)
2161     .groups(24)
2162     .group_output_channels(3)
2163     .iterations(3)
2164     .TestNHWCxQS8();
2165 }
2166 
2167 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 5x5_without_bias) {
2168   ConvolutionOperatorTester()
2169     .depthwise_layout(true)
2170     .has_bias(false)
2171     .input_size(15, 14)
2172     .padding(2, 2)
2173     .kernel_size(5, 5)
2174     .groups(24)
2175     .iterations(3)
2176     .TestNHWCxQS8();
2177 }
2178 
2179 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 7x7) {
2180   ConvolutionOperatorTester()
2181     .depthwise_layout(true)
2182     .input_size(15, 14)
2183     .padding(3, 3)
2184     .kernel_size(7, 7)
2185     .groups(24)
2186     .iterations(3)
2187     .TestNHWCxQS8();
2188 }
2189 
2190 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, 7x7_without_bias) {
2191   ConvolutionOperatorTester()
2192     .depthwise_layout(true)
2193     .has_bias(false)
2194     .input_size(15, 14)
2195     .padding(3, 3)
2196     .kernel_size(7, 7)
2197     .groups(24)
2198     .iterations(3)
2199     .TestNHWCxQS8();
2200 }
2201 
2202 // Tests dwconv microkernel with weights cache.
TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8,weights_cache_1x1)2203 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, weights_cache_1x1) {
2204   ConvolutionOperatorTester()
2205     .depthwise_layout(true)
2206     .input_size(15, 14)
2207     .kernel_size(1, 1)
2208     .groups(24)
2209     .use_weights_cache(true)
2210     .iterations(3)
2211     .TestNHWCxQS8();
2212 }
2213 
2214 // Tests dwconv microkernek with non 1x1 kernel (dwconv_hwg packing).
TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8,weights_cache_2x2)2215 TEST(DEPTHWISE_CONVOLUTION_NHWC_QS8, weights_cache_2x2) {
2216   ConvolutionOperatorTester()
2217     .depthwise_layout(true)
2218     .input_size(15, 14)
2219     .padding(1, 1)
2220     .kernel_size(2, 2)
2221     .groups(24)
2222     .use_weights_cache(true)
2223     .iterations(3)
2224     .TestNHWCxQS8();
2225 }
2226 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_input_buffer)2227 TEST(CONVOLUTION_NHWC_QS8, setup_changing_input_buffer) {
2228   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2229   ConvolutionOperatorTester()
2230     .batch_size(3)
2231     .input_height(8)
2232     .input_width(8)
2233     .kernel_height(5)
2234     .kernel_width(3)
2235     .group_input_channels(15)
2236     .group_output_channels(17)
2237     .TestSetupNHWCxQS8();
2238 }
2239 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_input_buffer_grouped)2240 TEST(CONVOLUTION_NHWC_QS8, setup_changing_input_buffer_grouped) {
2241   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2242   ConvolutionOperatorTester()
2243     .batch_size(3)
2244     .input_height(8)
2245     .input_width(8)
2246     .kernel_height(5)
2247     .kernel_width(3)
2248     .groups(2)
2249     .group_input_channels(15)
2250     .group_output_channels(17)
2251     .TestSetupNHWCxQS8();
2252 }
2253 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_input_buffer_depthwise)2254 TEST(CONVOLUTION_NHWC_QS8, setup_changing_input_buffer_depthwise) {
2255   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2256   ConvolutionOperatorTester()
2257     .batch_size(3)
2258     .input_height(8)
2259     .input_width(8)
2260     .kernel_height(3)
2261     .kernel_width(3)
2262     .groups(19)
2263     .group_input_channels(1)
2264     .group_output_channels(1)
2265     .TestSetupNHWCxQS8();
2266 }
2267 
TEST(CONVOLUTION_NHWC_QS8,setup_increasing_batch)2268 TEST(CONVOLUTION_NHWC_QS8, setup_increasing_batch) {
2269   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2270   ConvolutionOperatorTester()
2271     .batch_size(3)
2272     .next_batch_size(5)
2273     .input_height(8)
2274     .input_width(8)
2275     .kernel_height(5)
2276     .kernel_width(3)
2277     .group_input_channels(15)
2278     .group_output_channels(17)
2279     .TestSetupNHWCxQS8();
2280 }
2281 
TEST(CONVOLUTION_NHWC_QS8,setup_increasing_batch_grouped)2282 TEST(CONVOLUTION_NHWC_QS8, setup_increasing_batch_grouped) {
2283   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2284   ConvolutionOperatorTester()
2285     .batch_size(3)
2286     .next_batch_size(5)
2287     .input_height(8)
2288     .input_width(8)
2289     .kernel_height(5)
2290     .kernel_width(3)
2291     .groups(2)
2292     .group_input_channels(15)
2293     .group_output_channels(17)
2294     .TestSetupNHWCxQS8();
2295 }
2296 
TEST(CONVOLUTION_NHWC_QS8,setup_increasing_batch_depthwise)2297 TEST(CONVOLUTION_NHWC_QS8, setup_increasing_batch_depthwise) {
2298   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2299   ConvolutionOperatorTester()
2300     .batch_size(3)
2301     .next_batch_size(5)
2302     .input_height(8)
2303     .input_width(8)
2304     .kernel_height(3)
2305     .kernel_width(3)
2306     .groups(19)
2307     .group_input_channels(1)
2308     .group_output_channels(1)
2309     .TestSetupNHWCxQS8();
2310 }
2311 
TEST(CONVOLUTION_NHWC_QS8,setup_decreasing_batch)2312 TEST(CONVOLUTION_NHWC_QS8, setup_decreasing_batch) {
2313   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2314   ConvolutionOperatorTester()
2315     .batch_size(5)
2316     .next_batch_size(3)
2317     .input_height(8)
2318     .input_width(8)
2319     .kernel_height(5)
2320     .kernel_width(3)
2321     .group_input_channels(15)
2322     .group_output_channels(17)
2323     .TestSetupNHWCxQS8();
2324 }
2325 
TEST(CONVOLUTION_NHWC_QS8,setup_decreasing_batch_grouped)2326 TEST(CONVOLUTION_NHWC_QS8, setup_decreasing_batch_grouped) {
2327   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2328   ConvolutionOperatorTester()
2329     .batch_size(5)
2330     .next_batch_size(3)
2331     .input_height(8)
2332     .input_width(8)
2333     .kernel_height(5)
2334     .kernel_width(3)
2335     .groups(2)
2336     .group_input_channels(15)
2337     .group_output_channels(17)
2338     .TestSetupNHWCxQS8();
2339 }
2340 
TEST(CONVOLUTION_NHWC_QS8,setup_decreasing_batch_depthwise)2341 TEST(CONVOLUTION_NHWC_QS8, setup_decreasing_batch_depthwise) {
2342   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2343   ConvolutionOperatorTester()
2344     .batch_size(5)
2345     .next_batch_size(3)
2346     .input_height(8)
2347     .input_width(8)
2348     .kernel_height(3)
2349     .kernel_width(3)
2350     .groups(19)
2351     .group_input_channels(1)
2352     .group_output_channels(1)
2353     .TestSetupNHWCxQS8();
2354 }
2355 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_height)2356 TEST(CONVOLUTION_NHWC_QS8, setup_changing_height) {
2357   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2358   ConvolutionOperatorTester()
2359     .batch_size(3)
2360     .input_height(8)
2361     .input_width(8)
2362     .next_input_height(9)
2363     .kernel_height(5)
2364     .kernel_width(3)
2365     .group_input_channels(15)
2366     .group_output_channels(17)
2367     .TestSetupNHWCxQS8();
2368   ConvolutionOperatorTester()
2369     .batch_size(3)
2370     .input_height(8)
2371     .input_width(8)
2372     .next_input_height(7)
2373     .kernel_height(5)
2374     .kernel_width(3)
2375     .group_input_channels(15)
2376     .group_output_channels(17)
2377     .TestSetupNHWCxQS8();
2378 }
2379 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_height_grouped)2380 TEST(CONVOLUTION_NHWC_QS8, setup_changing_height_grouped) {
2381   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2382   ConvolutionOperatorTester()
2383     .batch_size(3)
2384     .input_height(8)
2385     .input_width(8)
2386     .next_input_height(9)
2387     .kernel_height(5)
2388     .kernel_width(3)
2389     .groups(2)
2390     .group_input_channels(15)
2391     .group_output_channels(17)
2392     .TestSetupNHWCxQS8();
2393   ConvolutionOperatorTester()
2394     .batch_size(3)
2395     .input_height(8)
2396     .input_width(8)
2397     .next_input_height(7)
2398     .kernel_height(5)
2399     .kernel_width(3)
2400     .groups(2)
2401     .group_input_channels(15)
2402     .group_output_channels(17)
2403     .TestSetupNHWCxQS8();
2404 }
2405 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_height_depthwise)2406 TEST(CONVOLUTION_NHWC_QS8, setup_changing_height_depthwise) {
2407   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2408   ConvolutionOperatorTester()
2409     .batch_size(3)
2410     .input_height(8)
2411     .input_width(8)
2412     .next_input_height(9)
2413     .kernel_height(3)
2414     .kernel_width(3)
2415     .groups(19)
2416     .group_input_channels(1)
2417     .group_output_channels(1)
2418     .TestSetupNHWCxQS8();
2419   ConvolutionOperatorTester()
2420     .batch_size(3)
2421     .input_height(8)
2422     .input_width(8)
2423     .next_input_height(7)
2424     .kernel_height(3)
2425     .kernel_width(3)
2426     .groups(19)
2427     .group_input_channels(1)
2428     .group_output_channels(1)
2429     .TestSetupNHWCxQS8();
2430 }
2431 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_width)2432 TEST(CONVOLUTION_NHWC_QS8, setup_changing_width) {
2433   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2434   ConvolutionOperatorTester()
2435     .batch_size(3)
2436     .input_height(8)
2437     .input_width(8)
2438     .next_input_width(9)
2439     .kernel_height(5)
2440     .kernel_width(3)
2441     .group_input_channels(15)
2442     .group_output_channels(17)
2443     .TestSetupNHWCxQS8();
2444   ConvolutionOperatorTester()
2445     .batch_size(3)
2446     .input_height(8)
2447     .input_width(8)
2448     .next_input_width(7)
2449     .kernel_height(5)
2450     .kernel_width(3)
2451     .group_input_channels(15)
2452     .group_output_channels(17)
2453     .TestSetupNHWCxQS8();
2454 }
2455 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_width_grouped)2456 TEST(CONVOLUTION_NHWC_QS8, setup_changing_width_grouped) {
2457   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2458   ConvolutionOperatorTester()
2459     .batch_size(3)
2460     .input_height(8)
2461     .input_width(8)
2462     .next_input_width(9)
2463     .kernel_height(5)
2464     .kernel_width(3)
2465     .groups(2)
2466     .group_input_channels(15)
2467     .group_output_channels(17)
2468     .TestSetupNHWCxQS8();
2469   ConvolutionOperatorTester()
2470     .batch_size(3)
2471     .input_height(8)
2472     .input_width(8)
2473     .next_input_width(7)
2474     .kernel_height(5)
2475     .kernel_width(3)
2476     .groups(2)
2477     .group_input_channels(15)
2478     .group_output_channels(17)
2479     .TestSetupNHWCxQS8();
2480 }
2481 
TEST(CONVOLUTION_NHWC_QS8,setup_changing_width_depthwise)2482 TEST(CONVOLUTION_NHWC_QS8, setup_changing_width_depthwise) {
2483   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2484   ConvolutionOperatorTester()
2485     .batch_size(3)
2486     .input_height(8)
2487     .input_width(8)
2488     .next_input_width(9)
2489     .kernel_height(3)
2490     .kernel_width(3)
2491     .groups(19)
2492     .group_input_channels(1)
2493     .group_output_channels(1)
2494     .TestSetupNHWCxQS8();
2495   ConvolutionOperatorTester()
2496     .batch_size(3)
2497     .input_height(8)
2498     .input_width(8)
2499     .next_input_width(7)
2500     .kernel_height(3)
2501     .kernel_width(3)
2502     .groups(19)
2503     .group_input_channels(1)
2504     .group_output_channels(1)
2505     .TestSetupNHWCxQS8();
2506 }
2507 
TEST(CONVOLUTION_NHWC_QS8,setup_swap_height_and_width)2508 TEST(CONVOLUTION_NHWC_QS8, setup_swap_height_and_width) {
2509   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2510   ConvolutionOperatorTester()
2511     .batch_size(3)
2512     .input_height(9)
2513     .input_width(8)
2514     .next_input_height(8)
2515     .next_input_width(9)
2516     .kernel_height(5)
2517     .kernel_width(3)
2518     .group_input_channels(15)
2519     .group_output_channels(17)
2520     .TestSetupNHWCxQS8();
2521 }
2522 
TEST(CONVOLUTION_NHWC_QS8,setup_swap_height_and_width_grouped)2523 TEST(CONVOLUTION_NHWC_QS8, setup_swap_height_and_width_grouped) {
2524   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2525   ConvolutionOperatorTester()
2526     .batch_size(3)
2527     .input_height(9)
2528     .input_width(8)
2529     .next_input_height(8)
2530     .next_input_width(9)
2531     .kernel_height(5)
2532     .kernel_width(3)
2533     .groups(2)
2534     .group_input_channels(15)
2535     .group_output_channels(17)
2536     .TestSetupNHWCxQS8();
2537 }
2538 
TEST(CONVOLUTION_NHWC_QS8,setup_swap_height_and_width_depthwise)2539 TEST(CONVOLUTION_NHWC_QS8, setup_swap_height_and_width_depthwise) {
2540   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
2541   ConvolutionOperatorTester()
2542     .batch_size(3)
2543     .input_height(9)
2544     .input_width(8)
2545     .next_input_height(8)
2546     .next_input_width(9)
2547     .kernel_height(3)
2548     .kernel_width(3)
2549     .groups(19)
2550     .group_input_channels(1)
2551     .group_output_channels(1)
2552     .TestSetupNHWCxQS8();
2553 }
2554 
2555 TEST(CONVOLUTION_NHWC_QU8, 1x1) {
2556   ConvolutionOperatorTester()
2557     .input_size(27, 29)
2558     .kernel_size(1, 1)
2559     .group_input_channels(23)
2560     .group_output_channels(19)
2561     .iterations(3)
2562     .TestNHWCxQU8();
2563 }
2564 
2565 TEST(CONVOLUTION_NHWC_QU8, 1x1_with_qmin) {
2566   ConvolutionOperatorTester()
2567     .input_size(27, 29)
2568     .kernel_size(1, 1)
2569     .group_input_channels(23)
2570     .group_output_channels(19)
2571     .qmin(128)
2572     .iterations(3)
2573     .TestNHWCxQU8();
2574 }
2575 
2576 TEST(CONVOLUTION_NHWC_QU8, 1x1_with_qmax) {
2577   ConvolutionOperatorTester()
2578     .input_size(27, 29)
2579     .kernel_size(1, 1)
2580     .group_input_channels(23)
2581     .group_output_channels(19)
2582     .qmax(128)
2583     .iterations(3)
2584     .TestNHWCxQU8();
2585 }
2586 
2587 TEST(CONVOLUTION_NHWC_QU8, 1x1_with_input_stride) {
2588   ConvolutionOperatorTester()
2589     .input_size(27, 29)
2590     .kernel_size(1, 1)
2591     .input_channel_stride(28)
2592     .group_input_channels(23)
2593     .group_output_channels(19)
2594     .iterations(3)
2595     .TestNHWCxQU8();
2596 }
2597 
2598 TEST(CONVOLUTION_NHWC_QU8, 1x1_with_output_stride) {
2599   ConvolutionOperatorTester()
2600     .input_size(27, 29)
2601     .kernel_size(1, 1)
2602     .output_channel_stride(29)
2603     .group_input_channels(23)
2604     .group_output_channels(19)
2605     .iterations(3)
2606     .TestNHWCxQU8();
2607 }
2608 
2609 TEST(CONVOLUTION_NHWC_QU8, 1x1_without_bias) {
2610   ConvolutionOperatorTester()
2611     .has_bias(false)
2612     .input_size(13, 14)
2613     .kernel_size(1, 1)
2614     .group_input_channels(23)
2615     .group_output_channels(19)
2616     .iterations(3)
2617     .TestNHWCxQU8();
2618 }
2619 
2620 TEST(CONVOLUTION_NHWC_QU8, 1x1_with_batch) {
2621   ConvolutionOperatorTester()
2622     .batch_size(3)
2623     .input_size(13, 14)
2624     .kernel_size(1, 1)
2625     .group_input_channels(23)
2626     .group_output_channels(19)
2627     .iterations(3)
2628     .TestNHWCxQU8();
2629 }
2630 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1)2631 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1) {
2632   ConvolutionOperatorTester()
2633     .input_size(24, 25)
2634     .kernel_size(1, 1)
2635     .groups(2)
2636     .group_input_channels(17)
2637     .group_output_channels(19)
2638     .iterations(3)
2639     .TestNHWCxQU8();
2640 }
2641 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1_with_qmin)2642 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1_with_qmin) {
2643   ConvolutionOperatorTester()
2644     .input_size(24, 25)
2645     .kernel_size(1, 1)
2646     .groups(2)
2647     .group_input_channels(17)
2648     .group_output_channels(19)
2649     .qmin(128)
2650     .iterations(3)
2651     .TestNHWCxQU8();
2652 }
2653 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1_with_qmax)2654 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1_with_qmax) {
2655   ConvolutionOperatorTester()
2656     .input_size(24, 25)
2657     .kernel_size(1, 1)
2658     .groups(2)
2659     .group_input_channels(17)
2660     .group_output_channels(19)
2661     .qmax(128)
2662     .iterations(3)
2663     .TestNHWCxQU8();
2664 }
2665 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1_with_input_stride)2666 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1_with_input_stride) {
2667   ConvolutionOperatorTester()
2668     .input_size(24, 25)
2669     .kernel_size(1, 1)
2670     .groups(2)
2671     .input_channel_stride(37)
2672     .group_input_channels(17)
2673     .group_output_channels(19)
2674     .iterations(3)
2675     .TestNHWCxQU8();
2676 }
2677 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1_with_output_stride)2678 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1_with_output_stride) {
2679   ConvolutionOperatorTester()
2680     .input_size(24, 25)
2681     .kernel_size(1, 1)
2682     .groups(2)
2683     .output_channel_stride(41)
2684     .group_input_channels(17)
2685     .group_output_channels(19)
2686     .iterations(3)
2687     .TestNHWCxQU8();
2688 }
2689 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1_without_bias)2690 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1_without_bias) {
2691   ConvolutionOperatorTester()
2692     .has_bias(false)
2693     .input_size(24, 25)
2694     .kernel_size(1, 1)
2695     .groups(2)
2696     .group_input_channels(17)
2697     .group_output_channels(19)
2698     .iterations(3)
2699     .TestNHWCxQU8();
2700 }
2701 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x1_with_batch)2702 TEST(CONVOLUTION_NHWC_QU8, grouped_1x1_with_batch) {
2703   ConvolutionOperatorTester()
2704     .batch_size(3)
2705     .input_size(24, 25)
2706     .kernel_size(1, 1)
2707     .groups(2)
2708     .group_input_channels(17)
2709     .group_output_channels(19)
2710     .iterations(3)
2711     .TestNHWCxQU8();
2712 }
2713 
2714 TEST(CONVOLUTION_NHWC_QU8, 1x3) {
2715   ConvolutionOperatorTester()
2716     .input_size(20, 19)
2717     .padding_width(1)
2718     .kernel_size(1, 3)
2719     .group_input_channels(17)
2720     .group_output_channels(15)
2721     .iterations(3)
2722     .TestNHWCxQU8();
2723 }
2724 
TEST(CONVOLUTION_NHWC_QU8,grouped_1x3)2725 TEST(CONVOLUTION_NHWC_QU8, grouped_1x3) {
2726   ConvolutionOperatorTester()
2727     .input_size(20, 19)
2728     .padding_width(1)
2729     .kernel_size(1, 3)
2730     .groups(2)
2731     .group_input_channels(17)
2732     .group_output_channels(15)
2733     .iterations(3)
2734     .TestNHWCxQU8();
2735 }
2736 
2737 TEST(CONVOLUTION_NHWC_QU8, 3x1) {
2738   ConvolutionOperatorTester()
2739     .input_size(19, 20)
2740     .padding_height(1)
2741     .kernel_size(3, 1)
2742     .group_input_channels(17)
2743     .group_output_channels(15)
2744     .iterations(3)
2745     .TestNHWCxQU8();
2746 }
2747 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x1)2748 TEST(CONVOLUTION_NHWC_QU8, grouped_3x1) {
2749   ConvolutionOperatorTester()
2750     .input_size(19, 20)
2751     .padding_height(1)
2752     .kernel_size(3, 1)
2753     .groups(2)
2754     .group_input_channels(17)
2755     .group_output_channels(15)
2756     .iterations(3)
2757     .TestNHWCxQU8();
2758 }
2759 
2760 TEST(CONVOLUTION_NHWC_QU8, 3x3) {
2761   ConvolutionOperatorTester()
2762     .input_size(13, 12)
2763     .padding(1)
2764     .kernel_size(3, 3)
2765     .group_input_channels(15)
2766     .group_output_channels(17)
2767     .iterations(3)
2768     .TestNHWCxQU8();
2769 }
2770 
2771 TEST(CONVOLUTION_NHWC_QU8, 3x3_without_padding) {
2772   ConvolutionOperatorTester()
2773     .input_size(13, 12)
2774     .kernel_size(3, 3)
2775     .group_input_channels(15)
2776     .group_output_channels(17)
2777     .iterations(3)
2778     .TestNHWCxQU8();
2779 }
2780 
2781 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_left_padding) {
2782   ConvolutionOperatorTester()
2783     .input_size(13, 12)
2784     .padding_left(1)
2785     .kernel_size(3, 3)
2786     .group_input_channels(15)
2787     .group_output_channels(17)
2788     .iterations(3)
2789     .TestNHWCxQU8();
2790 }
2791 
2792 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_right_padding) {
2793   ConvolutionOperatorTester()
2794     .input_size(13, 12)
2795     .padding_right(1)
2796     .kernel_size(3, 3)
2797     .group_input_channels(15)
2798     .group_output_channels(17)
2799     .iterations(3)
2800     .TestNHWCxQU8();
2801 }
2802 
2803 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_top_padding) {
2804   ConvolutionOperatorTester()
2805     .input_size(13, 12)
2806     .padding_top(1)
2807     .kernel_size(3, 3)
2808     .group_input_channels(15)
2809     .group_output_channels(17)
2810     .iterations(3)
2811     .TestNHWCxQU8();
2812 }
2813 
2814 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_bottom_padding) {
2815   ConvolutionOperatorTester()
2816     .input_size(13, 12)
2817     .padding_bottom(1)
2818     .kernel_size(3, 3)
2819     .group_input_channels(15)
2820     .group_output_channels(17)
2821     .iterations(3)
2822     .TestNHWCxQU8();
2823 }
2824 
2825 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_input_stride) {
2826   ConvolutionOperatorTester()
2827     .input_size(13, 12)
2828     .padding(1)
2829     .kernel_size(3, 3)
2830     .input_channel_stride(22)
2831     .group_input_channels(15)
2832     .group_output_channels(17)
2833     .iterations(3)
2834     .TestNHWCxQU8();
2835 }
2836 
2837 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_output_stride) {
2838   ConvolutionOperatorTester()
2839     .input_size(13, 12)
2840     .padding(1)
2841     .kernel_size(3, 3)
2842     .output_channel_stride(23)
2843     .group_input_channels(15)
2844     .group_output_channels(17)
2845     .iterations(3)
2846     .TestNHWCxQU8();
2847 }
2848 
2849 TEST(CONVOLUTION_NHWC_QU8, 3x3_without_bias) {
2850   ConvolutionOperatorTester()
2851     .has_bias(false)
2852     .input_size(10, 9)
2853     .padding(1)
2854     .kernel_size(3, 3)
2855     .group_input_channels(15)
2856     .group_output_channels(17)
2857     .iterations(3)
2858     .TestNHWCxQU8();
2859 }
2860 
2861 TEST(CONVOLUTION_NHWC_QU8, 3x3_with_batch) {
2862   ConvolutionOperatorTester()
2863     .batch_size(3)
2864     .input_size(10, 9)
2865     .padding(1)
2866     .kernel_size(3, 3)
2867     .group_input_channels(15)
2868     .group_output_channels(17)
2869     .iterations(3)
2870     .TestNHWCxQU8();
2871 }
2872 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3)2873 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3) {
2874   ConvolutionOperatorTester()
2875     .input_size(10, 11)
2876     .padding(1)
2877     .kernel_size(3, 3)
2878     .groups(2)
2879     .group_input_channels(14)
2880     .group_output_channels(13)
2881     .iterations(3)
2882     .TestNHWCxQU8();
2883 }
2884 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_without_padding)2885 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_without_padding) {
2886   ConvolutionOperatorTester()
2887     .input_size(13, 12)
2888     .kernel_size(3, 3)
2889     .group_input_channels(15)
2890     .group_output_channels(17)
2891     .iterations(3)
2892     .TestNHWCxQU8();
2893 }
2894 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_left_padding)2895 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_left_padding) {
2896   ConvolutionOperatorTester()
2897     .input_size(10, 11)
2898     .padding_left(1)
2899     .kernel_size(3, 3)
2900     .groups(2)
2901     .group_input_channels(14)
2902     .group_output_channels(13)
2903     .iterations(3)
2904     .TestNHWCxQU8();
2905 }
2906 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_right_padding)2907 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_right_padding) {
2908   ConvolutionOperatorTester()
2909     .input_size(10, 11)
2910     .padding_right(1)
2911     .kernel_size(3, 3)
2912     .groups(2)
2913     .group_input_channels(14)
2914     .group_output_channels(13)
2915     .iterations(3)
2916     .TestNHWCxQU8();
2917 }
2918 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_top_padding)2919 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_top_padding) {
2920   ConvolutionOperatorTester()
2921     .input_size(10, 11)
2922     .padding_top(1)
2923     .kernel_size(3, 3)
2924     .groups(2)
2925     .group_input_channels(14)
2926     .group_output_channels(13)
2927     .iterations(3)
2928     .TestNHWCxQU8();
2929 }
2930 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_bottom_padding)2931 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_bottom_padding) {
2932   ConvolutionOperatorTester()
2933     .input_size(10, 11)
2934     .padding_bottom(1)
2935     .kernel_size(3, 3)
2936     .groups(2)
2937     .group_input_channels(14)
2938     .group_output_channels(13)
2939     .iterations(3)
2940     .TestNHWCxQU8();
2941 }
2942 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_input_stride)2943 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_input_stride) {
2944   ConvolutionOperatorTester()
2945     .input_size(10, 11)
2946     .padding(1)
2947     .kernel_size(3, 3)
2948     .groups(2)
2949     .input_channel_stride(29)
2950     .group_input_channels(14)
2951     .group_output_channels(13)
2952     .iterations(3)
2953     .TestNHWCxQU8();
2954 }
2955 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_output_stride)2956 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_output_stride) {
2957   ConvolutionOperatorTester()
2958     .input_size(10, 11)
2959     .padding(1)
2960     .kernel_size(3, 3)
2961     .groups(2)
2962     .output_channel_stride(31)
2963     .group_input_channels(14)
2964     .group_output_channels(13)
2965     .iterations(3)
2966     .TestNHWCxQU8();
2967 }
2968 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_without_bias)2969 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_without_bias) {
2970   ConvolutionOperatorTester()
2971     .has_bias(false)
2972     .input_size(10, 11)
2973     .padding(1)
2974     .kernel_size(3, 3)
2975     .groups(2)
2976     .group_input_channels(14)
2977     .group_output_channels(13)
2978     .iterations(3)
2979     .TestNHWCxQU8();
2980 }
2981 
TEST(CONVOLUTION_NHWC_QU8,grouped_3x3_with_batch)2982 TEST(CONVOLUTION_NHWC_QU8, grouped_3x3_with_batch) {
2983   ConvolutionOperatorTester()
2984     .batch_size(3)
2985     .input_size(10, 11)
2986     .padding(1)
2987     .kernel_size(3, 3)
2988     .groups(2)
2989     .group_input_channels(14)
2990     .group_output_channels(13)
2991     .iterations(3)
2992     .TestNHWCxQU8();
2993 }
2994 
2995 TEST(CONVOLUTION_NHWC_QU8, 3x3s2) {
2996   ConvolutionOperatorTester()
2997     .input_size(14, 13)
2998     .padding(1)
2999     .kernel_size(3, 3)
3000     .subsampling(2)
3001     .group_input_channels(27)
3002     .group_output_channels(19)
3003     .iterations(3)
3004     .TestNHWCxQU8();
3005 }
3006 
3007 TEST(CONVOLUTION_NHWC_QU8, 3x3s2_with_tf_same_padding) {
3008   for (size_t input_height = 13; input_height <= 14; input_height++) {
3009     for (size_t input_width = 13; input_width <= 14; input_width++) {
3010       ConvolutionOperatorTester()
3011         .input_size(input_height, input_width)
3012         .padding_tf_same(true)
3013         .kernel_size(3, 3)
3014         .subsampling(2)
3015         .group_input_channels(27)
3016         .group_output_channels(19)
3017         .iterations(3)
3018         .TestNHWCxQU8();
3019     }
3020   }
3021 }
3022 
3023 TEST(CONVOLUTION_NHWC_QU8, 3x3s1x2) {
3024   ConvolutionOperatorTester()
3025     .input_size(14, 13)
3026     .padding(1)
3027     .kernel_size(3, 3)
3028     .subsampling(1, 2)
3029     .group_input_channels(27)
3030     .group_output_channels(19)
3031     .iterations(3)
3032     .TestNHWCxQU8();
3033 }
3034 
3035 TEST(CONVOLUTION_NHWC_QU8, 3x3s1x2_with_tf_same_padding) {
3036   for (size_t input_height = 13; input_height <= 14; input_height++) {
3037     for (size_t input_width = 13; input_width <= 14; input_width++) {
3038       ConvolutionOperatorTester()
3039         .input_size(input_height, input_width)
3040         .padding_tf_same(true)
3041         .kernel_size(3, 3)
3042         .subsampling(1, 2)
3043         .group_input_channels(27)
3044         .group_output_channels(19)
3045         .iterations(3)
3046         .TestNHWCxQU8();
3047     }
3048   }
3049 }
3050 
3051 TEST(CONVOLUTION_NHWC_QU8, 3x3s2x1) {
3052   ConvolutionOperatorTester()
3053     .input_size(14, 13)
3054     .padding(1)
3055     .kernel_size(3, 3)
3056     .subsampling(2, 1)
3057     .group_input_channels(27)
3058     .group_output_channels(19)
3059     .iterations(3)
3060     .TestNHWCxQU8();
3061 }
3062 
3063 TEST(CONVOLUTION_NHWC_QU8, 3x3s2x1_with_tf_same_padding) {
3064   for (size_t input_height = 13; input_height <= 14; input_height++) {
3065     for (size_t input_width = 13; input_width <= 14; input_width++) {
3066       ConvolutionOperatorTester()
3067         .input_size(input_height, input_width)
3068         .padding_tf_same(true)
3069         .kernel_size(3, 3)
3070         .subsampling(2, 1)
3071         .group_input_channels(27)
3072         .group_output_channels(19)
3073         .iterations(3)
3074         .TestNHWCxQU8();
3075     }
3076   }
3077 }
3078 
3079 TEST(CONVOLUTION_NHWC_QU8, 3x3d2) {
3080   ConvolutionOperatorTester()
3081     .input_size(14, 13)
3082     .padding(2)
3083     .kernel_size(3, 3)
3084     .dilation(2)
3085     .group_input_channels(27)
3086     .group_output_channels(19)
3087     .iterations(3)
3088     .TestNHWCxQU8();
3089 }
3090 
3091 TEST(CONVOLUTION_NHWC_QU8, 3x3d1x2) {
3092   ConvolutionOperatorTester()
3093     .input_size(14, 13)
3094     .padding(1, 2)
3095     .kernel_size(3, 3)
3096     .dilation(1, 2)
3097     .group_input_channels(27)
3098     .group_output_channels(19)
3099     .iterations(3)
3100     .TestNHWCxQU8();
3101 }
3102 
3103 TEST(CONVOLUTION_NHWC_QU8, 3x3d2x1) {
3104   ConvolutionOperatorTester()
3105     .input_size(14, 13)
3106     .padding(2, 1)
3107     .kernel_size(3, 3)
3108     .dilation(2, 1)
3109     .group_input_channels(27)
3110     .group_output_channels(19)
3111     .iterations(3)
3112     .TestNHWCxQU8();
3113 }
3114 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3)3115 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3) {
3116   ConvolutionOperatorTester()
3117     .input_size(15, 14)
3118     .padding(1, 1)
3119     .kernel_size(3, 3)
3120     .groups(27)
3121     .iterations(3)
3122     .TestNHWCxQU8();
3123 }
3124 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3_without_bias)3125 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3_without_bias) {
3126   ConvolutionOperatorTester()
3127     .has_bias(false)
3128     .input_size(15, 14)
3129     .padding(1, 1)
3130     .kernel_size(3, 3)
3131     .groups(27)
3132     .iterations(3)
3133     .TestNHWCxQU8();
3134 }
3135 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3s2)3136 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3s2) {
3137   ConvolutionOperatorTester()
3138     .input_size(15, 14)
3139     .padding(1, 1)
3140     .kernel_size(3, 3)
3141     .subsampling(2)
3142     .groups(27)
3143     .iterations(3)
3144     .TestNHWCxQU8();
3145 }
3146 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3s2_with_tf_same_padding)3147 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3s2_with_tf_same_padding) {
3148   for (size_t input_height = 14; input_height <= 15; input_height++) {
3149     for (size_t input_width = 14; input_width <= 15; input_width++) {
3150       ConvolutionOperatorTester()
3151         .input_size(input_height, input_width)
3152         .padding_tf_same(true)
3153         .kernel_size(3, 3)
3154         .subsampling(2)
3155         .groups(27)
3156         .iterations(3)
3157         .TestNHWCxQU8();
3158     }
3159   }
3160 }
3161 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3s1x2)3162 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3s1x2) {
3163   ConvolutionOperatorTester()
3164     .input_size(15, 14)
3165     .padding(1, 1)
3166     .kernel_size(3, 3)
3167     .subsampling(1, 2)
3168     .groups(27)
3169     .iterations(3)
3170     .TestNHWCxQU8();
3171 }
3172 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3s1x2_with_tf_same_padding)3173 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3s1x2_with_tf_same_padding) {
3174   for (size_t input_height = 14; input_height <= 15; input_height++) {
3175     for (size_t input_width = 14; input_width <= 15; input_width++) {
3176       ConvolutionOperatorTester()
3177         .input_size(input_height, input_width)
3178         .padding_tf_same(true)
3179         .kernel_size(3, 3)
3180         .subsampling(1, 2)
3181         .groups(27)
3182         .iterations(3)
3183         .TestNHWCxQU8();
3184     }
3185   }
3186 }
3187 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3s2x1)3188 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3s2x1) {
3189   ConvolutionOperatorTester()
3190     .input_size(15, 14)
3191     .padding(1, 1)
3192     .kernel_size(3, 3)
3193     .subsampling(2, 1)
3194     .groups(27)
3195     .iterations(3)
3196     .TestNHWCxQU8();
3197 }
3198 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3s2x1_with_tf_same_padding)3199 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3s2x1_with_tf_same_padding) {
3200   for (size_t input_height = 14; input_height <= 15; input_height++) {
3201     for (size_t input_width = 14; input_width <= 15; input_width++) {
3202       ConvolutionOperatorTester()
3203         .input_size(input_height, input_width)
3204         .padding_tf_same(true)
3205         .kernel_size(3, 3)
3206         .subsampling(2, 1)
3207         .groups(27)
3208         .iterations(3)
3209         .TestNHWCxQU8();
3210     }
3211   }
3212 }
3213 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3d2)3214 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3d2) {
3215   ConvolutionOperatorTester()
3216     .input_size(15, 14)
3217     .padding(1, 1)
3218     .kernel_size(3, 3)
3219     .dilation(2)
3220     .groups(27)
3221     .iterations(3)
3222     .TestNHWCxQU8();
3223 }
3224 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3d1x2)3225 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3d1x2) {
3226   ConvolutionOperatorTester()
3227     .input_size(15, 14)
3228     .padding(1, 1)
3229     .kernel_size(3, 3)
3230     .dilation(1, 2)
3231     .groups(27)
3232     .iterations(3)
3233     .TestNHWCxQU8();
3234 }
3235 
TEST(CONVOLUTION_NHWC_QU8,depthwise_3x3d2x1)3236 TEST(CONVOLUTION_NHWC_QU8, depthwise_3x3d2x1) {
3237   ConvolutionOperatorTester()
3238     .input_size(15, 14)
3239     .padding(1, 1)
3240     .kernel_size(3, 3)
3241     .dilation(2, 1)
3242     .groups(27)
3243     .iterations(3)
3244     .TestNHWCxQU8();
3245 }
3246 
3247 // Tests GEMM microkernel with weights_cache.
TEST(CONVOLUTION_NHWC_QU8,weights_cache_1x1)3248 TEST(CONVOLUTION_NHWC_QU8, weights_cache_1x1) {
3249   ConvolutionOperatorTester()
3250     .input_size(27, 29)
3251     .kernel_size(1, 1)
3252     .group_input_channels(23)
3253     .group_output_channels(19)
3254     .use_weights_cache(true)
3255     .iterations(3)
3256     .TestNHWCxQU8();
3257 }
3258 
3259 // Tests IGEMM microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QU8,weights_cache_3x3)3260 TEST(CONVOLUTION_NHWC_QU8, weights_cache_3x3) {
3261   ConvolutionOperatorTester()
3262     .input_size(13, 12)
3263     .padding(1)
3264     .kernel_size(3, 3)
3265     .group_input_channels(15)
3266     .group_output_channels(17)
3267     .use_weights_cache(true)
3268     .iterations(3)
3269     .TestNHWCxQU8();
3270 }
3271 
3272 // Tests vmulcaddc microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QU8,weights_cache_depthwise_1x1)3273 TEST(CONVOLUTION_NHWC_QU8, weights_cache_depthwise_1x1) {
3274   ConvolutionOperatorTester()
3275     .input_size(15, 14)
3276     .kernel_size(1, 1)
3277     .groups(24)
3278     .use_weights_cache(true)
3279     .iterations(3)
3280     .TestNHWCxQU8();
3281 }
3282 
3283 // Tests dwconv microkernel with weights cache.
TEST(CONVOLUTION_NHWC_QU8,weights_cache_depthwise_2x2d2)3284 TEST(CONVOLUTION_NHWC_QU8, weights_cache_depthwise_2x2d2) {
3285   ConvolutionOperatorTester()
3286     .input_size(15, 14)
3287     .padding(1, 1)
3288     .kernel_size(2, 2)
3289     .dilation(2)
3290     .groups(27)
3291     .iterations(3)
3292     .use_weights_cache(true)
3293     .TestNHWCxQU8();
3294 }
3295 
3296 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 1x1) {
3297   ConvolutionOperatorTester()
3298     .depthwise_layout(true)
3299     .input_size(15, 14)
3300     .kernel_size(1, 1)
3301     .groups(24)
3302     .iterations(3)
3303     .TestNHWCxQU8();
3304 }
3305 
3306 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 1x1_with_depth_multiplier) {
3307   ConvolutionOperatorTester()
3308     .depthwise_layout(true)
3309     .input_size(15, 14)
3310     .kernel_size(1, 1)
3311     .groups(24)
3312     .group_output_channels(3)
3313     .iterations(3)
3314     .TestNHWCxQU8();
3315 }
3316 
3317 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 1x1_without_bias) {
3318   ConvolutionOperatorTester()
3319     .depthwise_layout(true)
3320     .has_bias(false)
3321     .input_size(15, 14)
3322     .kernel_size(1, 1)
3323     .groups(24)
3324     .iterations(3)
3325     .TestNHWCxQU8();
3326 }
3327 
3328 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 2x2) {
3329   ConvolutionOperatorTester()
3330     .depthwise_layout(true)
3331     .input_size(15, 14)
3332     .padding(1, 1)
3333     .kernel_size(2, 2)
3334     .groups(24)
3335     .iterations(3)
3336     .TestNHWCxQU8();
3337 }
3338 
3339 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 2x2_with_depth_multiplier) {
3340   ConvolutionOperatorTester()
3341     .depthwise_layout(true)
3342     .input_size(15, 14)
3343     .padding(1, 1)
3344     .kernel_size(2, 2)
3345     .groups(24)
3346     .group_output_channels(3)
3347     .iterations(3)
3348     .TestNHWCxQU8();
3349 }
3350 
3351 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 2x2_without_bias) {
3352   ConvolutionOperatorTester()
3353     .depthwise_layout(true)
3354     .has_bias(false)
3355     .input_size(15, 14)
3356     .padding(1, 1)
3357     .kernel_size(2, 2)
3358     .groups(24)
3359     .iterations(3)
3360     .TestNHWCxQU8();
3361 }
3362 
3363 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 3x3) {
3364   ConvolutionOperatorTester()
3365     .depthwise_layout(true)
3366     .input_size(15, 14)
3367     .padding(1, 1)
3368     .kernel_size(3, 3)
3369     .groups(24)
3370     .iterations(3)
3371     .TestNHWCxQU8();
3372 }
3373 
3374 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 3x3_with_depth_multiplier) {
3375   ConvolutionOperatorTester()
3376     .depthwise_layout(true)
3377     .input_size(15, 14)
3378     .padding(1, 1)
3379     .kernel_size(3, 3)
3380     .groups(24)
3381     .group_output_channels(3)
3382     .iterations(3)
3383     .TestNHWCxQU8();
3384 }
3385 
3386 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 3x3_without_bias) {
3387   ConvolutionOperatorTester()
3388     .depthwise_layout(true)
3389     .has_bias(false)
3390     .input_size(15, 14)
3391     .padding(1, 1)
3392     .kernel_size(3, 3)
3393     .groups(24)
3394     .iterations(3)
3395     .TestNHWCxQU8();
3396 }
3397 
3398 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 3x3s2_with_tf_same_padding) {
3399   for (size_t input_height = 14; input_height <= 15; input_height++) {
3400     for (size_t input_width = 14; input_width <= 15; input_width++) {
3401       ConvolutionOperatorTester()
3402         .depthwise_layout(true)
3403         .input_size(input_height, input_width)
3404         .padding_tf_same(true)
3405         .kernel_size(3, 3)
3406         .groups(24)
3407         .iterations(3)
3408         .TestNHWCxQU8();
3409     }
3410   }
3411 }
3412 
3413 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 5x5) {
3414   ConvolutionOperatorTester()
3415     .depthwise_layout(true)
3416     .input_size(15, 14)
3417     .padding(2, 2)
3418     .kernel_size(5, 5)
3419     .groups(24)
3420     .iterations(3)
3421     .TestNHWCxQU8();
3422 }
3423 
3424 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 5x5_with_depth_multiplier) {
3425   ConvolutionOperatorTester()
3426     .depthwise_layout(true)
3427     .input_size(15, 14)
3428     .padding(2, 2)
3429     .kernel_size(5, 5)
3430     .groups(24)
3431     .group_output_channels(3)
3432     .iterations(3)
3433     .TestNHWCxQU8();
3434 }
3435 
3436 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 5x5_without_bias) {
3437   ConvolutionOperatorTester()
3438     .depthwise_layout(true)
3439     .has_bias(false)
3440     .input_size(15, 14)
3441     .padding(2, 2)
3442     .kernel_size(5, 5)
3443     .groups(24)
3444     .iterations(3)
3445     .TestNHWCxQU8();
3446 }
3447 
3448 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 7x7) {
3449   ConvolutionOperatorTester()
3450     .depthwise_layout(true)
3451     .input_size(15, 14)
3452     .padding(3, 3)
3453     .kernel_size(7, 7)
3454     .groups(24)
3455     .iterations(3)
3456     .TestNHWCxQU8();
3457 }
3458 
3459 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, 7x7_without_bias) {
3460   ConvolutionOperatorTester()
3461     .depthwise_layout(true)
3462     .has_bias(false)
3463     .input_size(15, 14)
3464     .padding(3, 3)
3465     .kernel_size(7, 7)
3466     .groups(24)
3467     .iterations(3)
3468     .TestNHWCxQU8();
3469 }
3470 
3471 // Tests dwconv microkernel with weights cache.
TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8,weights_cache_1x1)3472 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, weights_cache_1x1) {
3473   ConvolutionOperatorTester()
3474     .depthwise_layout(true)
3475     .input_size(15, 14)
3476     .kernel_size(1, 1)
3477     .groups(24)
3478     .use_weights_cache(true)
3479     .iterations(3)
3480     .TestNHWCxQU8();
3481 }
3482 
3483 // Tests dwconv microkernek with non 1x1 kernel (dwconv_hwg packing).
TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8,weights_cache_2x2)3484 TEST(DEPTHWISE_CONVOLUTION_NHWC_QU8, weights_cache_2x2) {
3485   ConvolutionOperatorTester()
3486     .depthwise_layout(true)
3487     .input_size(15, 14)
3488     .padding(1, 1)
3489     .kernel_size(2, 2)
3490     .groups(24)
3491     .use_weights_cache(true)
3492     .iterations(3)
3493     .TestNHWCxQU8();
3494 }
3495 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_input_buffer)3496 TEST(CONVOLUTION_NHWC_QU8, setup_changing_input_buffer) {
3497   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3498   ConvolutionOperatorTester()
3499     .batch_size(3)
3500     .input_height(8)
3501     .input_width(8)
3502     .kernel_height(5)
3503     .kernel_width(3)
3504     .group_input_channels(15)
3505     .group_output_channels(17)
3506     .TestSetupNHWCxQU8();
3507 }
3508 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_input_buffer_grouped)3509 TEST(CONVOLUTION_NHWC_QU8, setup_changing_input_buffer_grouped) {
3510   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3511   ConvolutionOperatorTester()
3512     .batch_size(3)
3513     .input_height(8)
3514     .input_width(8)
3515     .kernel_height(5)
3516     .kernel_width(3)
3517     .groups(2)
3518     .group_input_channels(15)
3519     .group_output_channels(17)
3520     .TestSetupNHWCxQU8();
3521 }
3522 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_input_buffer_depthwise)3523 TEST(CONVOLUTION_NHWC_QU8, setup_changing_input_buffer_depthwise) {
3524   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3525   ConvolutionOperatorTester()
3526     .batch_size(3)
3527     .input_height(8)
3528     .input_width(8)
3529     .kernel_height(3)
3530     .kernel_width(3)
3531     .groups(19)
3532     .group_input_channels(1)
3533     .group_output_channels(1)
3534     .TestSetupNHWCxQU8();
3535 }
3536 
TEST(CONVOLUTION_NHWC_QU8,setup_increasing_batch)3537 TEST(CONVOLUTION_NHWC_QU8, setup_increasing_batch) {
3538   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3539   ConvolutionOperatorTester()
3540     .batch_size(3)
3541     .next_batch_size(5)
3542     .input_height(8)
3543     .input_width(8)
3544     .kernel_height(5)
3545     .kernel_width(3)
3546     .group_input_channels(15)
3547     .group_output_channels(17)
3548     .TestSetupNHWCxQU8();
3549 }
3550 
TEST(CONVOLUTION_NHWC_QU8,setup_increasing_batch_grouped)3551 TEST(CONVOLUTION_NHWC_QU8, setup_increasing_batch_grouped) {
3552   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3553   ConvolutionOperatorTester()
3554     .batch_size(3)
3555     .next_batch_size(5)
3556     .input_height(8)
3557     .input_width(8)
3558     .kernel_height(5)
3559     .kernel_width(3)
3560     .groups(2)
3561     .group_input_channels(15)
3562     .group_output_channels(17)
3563     .TestSetupNHWCxQU8();
3564 }
3565 
TEST(CONVOLUTION_NHWC_QU8,setup_increasing_batch_depthwise)3566 TEST(CONVOLUTION_NHWC_QU8, setup_increasing_batch_depthwise) {
3567   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3568   ConvolutionOperatorTester()
3569     .batch_size(3)
3570     .next_batch_size(5)
3571     .input_height(8)
3572     .input_width(8)
3573     .kernel_height(3)
3574     .kernel_width(3)
3575     .groups(19)
3576     .group_input_channels(1)
3577     .group_output_channels(1)
3578     .TestSetupNHWCxQU8();
3579 }
3580 
TEST(CONVOLUTION_NHWC_QU8,setup_decreasing_batch)3581 TEST(CONVOLUTION_NHWC_QU8, setup_decreasing_batch) {
3582   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3583   ConvolutionOperatorTester()
3584     .batch_size(5)
3585     .next_batch_size(3)
3586     .input_height(8)
3587     .input_width(8)
3588     .kernel_height(5)
3589     .kernel_width(3)
3590     .group_input_channels(15)
3591     .group_output_channels(17)
3592     .TestSetupNHWCxQU8();
3593 }
3594 
TEST(CONVOLUTION_NHWC_QU8,setup_decreasing_batch_grouped)3595 TEST(CONVOLUTION_NHWC_QU8, setup_decreasing_batch_grouped) {
3596   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3597   ConvolutionOperatorTester()
3598     .batch_size(5)
3599     .next_batch_size(3)
3600     .input_height(8)
3601     .input_width(8)
3602     .kernel_height(5)
3603     .kernel_width(3)
3604     .groups(2)
3605     .group_input_channels(15)
3606     .group_output_channels(17)
3607     .TestSetupNHWCxQU8();
3608 }
3609 
TEST(CONVOLUTION_NHWC_QU8,setup_decreasing_batch_depthwise)3610 TEST(CONVOLUTION_NHWC_QU8, setup_decreasing_batch_depthwise) {
3611   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3612   ConvolutionOperatorTester()
3613     .batch_size(5)
3614     .next_batch_size(3)
3615     .input_height(8)
3616     .input_width(8)
3617     .kernel_height(3)
3618     .kernel_width(3)
3619     .groups(19)
3620     .group_input_channels(1)
3621     .group_output_channels(1)
3622     .TestSetupNHWCxQU8();
3623 }
3624 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_height)3625 TEST(CONVOLUTION_NHWC_QU8, setup_changing_height) {
3626   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3627   ConvolutionOperatorTester()
3628     .batch_size(3)
3629     .input_height(8)
3630     .input_width(8)
3631     .next_input_height(9)
3632     .kernel_height(5)
3633     .kernel_width(3)
3634     .group_input_channels(15)
3635     .group_output_channels(17)
3636     .TestSetupNHWCxQU8();
3637   ConvolutionOperatorTester()
3638     .batch_size(3)
3639     .input_height(8)
3640     .input_width(8)
3641     .next_input_height(7)
3642     .kernel_height(5)
3643     .kernel_width(3)
3644     .group_input_channels(15)
3645     .group_output_channels(17)
3646     .TestSetupNHWCxQU8();
3647 }
3648 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_height_grouped)3649 TEST(CONVOLUTION_NHWC_QU8, setup_changing_height_grouped) {
3650   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3651   ConvolutionOperatorTester()
3652     .batch_size(3)
3653     .input_height(8)
3654     .input_width(8)
3655     .next_input_height(9)
3656     .kernel_height(5)
3657     .kernel_width(3)
3658     .groups(2)
3659     .group_input_channels(15)
3660     .group_output_channels(17)
3661     .TestSetupNHWCxQU8();
3662   ConvolutionOperatorTester()
3663     .batch_size(3)
3664     .input_height(8)
3665     .input_width(8)
3666     .next_input_height(7)
3667     .kernel_height(5)
3668     .kernel_width(3)
3669     .groups(2)
3670     .group_input_channels(15)
3671     .group_output_channels(17)
3672     .TestSetupNHWCxQU8();
3673 }
3674 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_height_depthwise)3675 TEST(CONVOLUTION_NHWC_QU8, setup_changing_height_depthwise) {
3676   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3677   ConvolutionOperatorTester()
3678     .batch_size(3)
3679     .input_height(8)
3680     .input_width(8)
3681     .next_input_height(9)
3682     .kernel_height(3)
3683     .kernel_width(3)
3684     .groups(19)
3685     .group_input_channels(1)
3686     .group_output_channels(1)
3687     .TestSetupNHWCxQU8();
3688   ConvolutionOperatorTester()
3689     .batch_size(3)
3690     .input_height(8)
3691     .input_width(8)
3692     .next_input_height(7)
3693     .kernel_height(3)
3694     .kernel_width(3)
3695     .groups(19)
3696     .group_input_channels(1)
3697     .group_output_channels(1)
3698     .TestSetupNHWCxQU8();
3699 }
3700 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_width)3701 TEST(CONVOLUTION_NHWC_QU8, setup_changing_width) {
3702   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3703   ConvolutionOperatorTester()
3704     .batch_size(3)
3705     .input_height(8)
3706     .input_width(8)
3707     .next_input_width(9)
3708     .kernel_height(5)
3709     .kernel_width(3)
3710     .group_input_channels(15)
3711     .group_output_channels(17)
3712     .TestSetupNHWCxQU8();
3713   ConvolutionOperatorTester()
3714     .batch_size(3)
3715     .input_height(8)
3716     .input_width(8)
3717     .next_input_width(7)
3718     .kernel_height(5)
3719     .kernel_width(3)
3720     .group_input_channels(15)
3721     .group_output_channels(17)
3722     .TestSetupNHWCxQU8();
3723 }
3724 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_width_grouped)3725 TEST(CONVOLUTION_NHWC_QU8, setup_changing_width_grouped) {
3726   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3727   ConvolutionOperatorTester()
3728     .batch_size(3)
3729     .input_height(8)
3730     .input_width(8)
3731     .next_input_width(9)
3732     .kernel_height(5)
3733     .kernel_width(3)
3734     .groups(2)
3735     .group_input_channels(15)
3736     .group_output_channels(17)
3737     .TestSetupNHWCxQU8();
3738   ConvolutionOperatorTester()
3739     .batch_size(3)
3740     .input_height(8)
3741     .input_width(8)
3742     .next_input_width(7)
3743     .kernel_height(5)
3744     .kernel_width(3)
3745     .groups(2)
3746     .group_input_channels(15)
3747     .group_output_channels(17)
3748     .TestSetupNHWCxQU8();
3749 }
3750 
TEST(CONVOLUTION_NHWC_QU8,setup_changing_width_depthwise)3751 TEST(CONVOLUTION_NHWC_QU8, setup_changing_width_depthwise) {
3752   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3753   ConvolutionOperatorTester()
3754     .batch_size(3)
3755     .input_height(8)
3756     .input_width(8)
3757     .next_input_width(9)
3758     .kernel_height(3)
3759     .kernel_width(3)
3760     .groups(19)
3761     .group_input_channels(1)
3762     .group_output_channels(1)
3763     .TestSetupNHWCxQU8();
3764   ConvolutionOperatorTester()
3765     .batch_size(3)
3766     .input_height(8)
3767     .input_width(8)
3768     .next_input_width(7)
3769     .kernel_height(3)
3770     .kernel_width(3)
3771     .groups(19)
3772     .group_input_channels(1)
3773     .group_output_channels(1)
3774     .TestSetupNHWCxQU8();
3775 }
3776 
TEST(CONVOLUTION_NHWC_QU8,setup_swap_height_and_width)3777 TEST(CONVOLUTION_NHWC_QU8, setup_swap_height_and_width) {
3778   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3779   ConvolutionOperatorTester()
3780     .batch_size(3)
3781     .input_height(9)
3782     .input_width(8)
3783     .next_input_height(8)
3784     .next_input_width(9)
3785     .kernel_height(5)
3786     .kernel_width(3)
3787     .group_input_channels(15)
3788     .group_output_channels(17)
3789     .TestSetupNHWCxQU8();
3790 }
3791 
TEST(CONVOLUTION_NHWC_QU8,setup_swap_height_and_width_grouped)3792 TEST(CONVOLUTION_NHWC_QU8, setup_swap_height_and_width_grouped) {
3793   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3794   ConvolutionOperatorTester()
3795     .batch_size(3)
3796     .input_height(9)
3797     .input_width(8)
3798     .next_input_height(8)
3799     .next_input_width(9)
3800     .kernel_height(5)
3801     .kernel_width(3)
3802     .groups(2)
3803     .group_input_channels(15)
3804     .group_output_channels(17)
3805     .TestSetupNHWCxQU8();
3806 }
3807 
TEST(CONVOLUTION_NHWC_QU8,setup_swap_height_and_width_depthwise)3808 TEST(CONVOLUTION_NHWC_QU8, setup_swap_height_and_width_depthwise) {
3809   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
3810   ConvolutionOperatorTester()
3811     .batch_size(3)
3812     .input_height(9)
3813     .input_width(8)
3814     .next_input_height(8)
3815     .next_input_width(9)
3816     .kernel_height(3)
3817     .kernel_width(3)
3818     .groups(19)
3819     .group_input_channels(1)
3820     .group_output_channels(1)
3821     .TestSetupNHWCxQU8();
3822 }
3823 
3824 TEST(CONVOLUTION_NHWC_F32, 1x1) {
3825   ConvolutionOperatorTester()
3826     .input_size(27, 29)
3827     .kernel_size(1, 1)
3828     .group_input_channels(23)
3829     .group_output_channels(19)
3830     .iterations(3)
3831     .TestNHWCxF32();
3832 }
3833 
3834 TEST(CONVOLUTION_NHWC_F32, 1x1_with_qmin) {
3835   ConvolutionOperatorTester()
3836     .input_size(27, 29)
3837     .kernel_size(1, 1)
3838     .group_input_channels(23)
3839     .group_output_channels(19)
3840     .qmin(128)
3841     .iterations(3)
3842     .TestNHWCxF32();
3843 }
3844 
3845 TEST(CONVOLUTION_NHWC_F32, 1x1_with_qmax) {
3846   ConvolutionOperatorTester()
3847     .input_size(27, 29)
3848     .kernel_size(1, 1)
3849     .group_input_channels(23)
3850     .group_output_channels(19)
3851     .qmax(128)
3852     .iterations(3)
3853     .TestNHWCxF32();
3854 }
3855 
3856 TEST(CONVOLUTION_NHWC_F32, 1x1_with_input_stride) {
3857   ConvolutionOperatorTester()
3858     .input_size(27, 29)
3859     .kernel_size(1, 1)
3860     .input_channel_stride(28)
3861     .group_input_channels(23)
3862     .group_output_channels(19)
3863     .iterations(3)
3864     .TestNHWCxF32();
3865 }
3866 
3867 TEST(CONVOLUTION_NHWC_F32, 1x1_with_output_stride) {
3868   ConvolutionOperatorTester()
3869     .input_size(27, 29)
3870     .kernel_size(1, 1)
3871     .output_channel_stride(29)
3872     .group_input_channels(23)
3873     .group_output_channels(19)
3874     .iterations(3)
3875     .TestNHWCxF32();
3876 }
3877 
3878 TEST(CONVOLUTION_NHWC_F32, 1x1_without_bias) {
3879   ConvolutionOperatorTester()
3880     .has_bias(false)
3881     .input_size(13, 14)
3882     .kernel_size(1, 1)
3883     .group_input_channels(23)
3884     .group_output_channels(19)
3885     .iterations(3)
3886     .TestNHWCxF32();
3887 }
3888 
3889 TEST(CONVOLUTION_NHWC_F32, 1x1_with_batch) {
3890   ConvolutionOperatorTester()
3891     .batch_size(3)
3892     .input_size(13, 14)
3893     .kernel_size(1, 1)
3894     .group_input_channels(23)
3895     .group_output_channels(19)
3896     .iterations(3)
3897     .TestNHWCxF32();
3898 }
3899 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1)3900 TEST(CONVOLUTION_NHWC_F32, grouped_1x1) {
3901   ConvolutionOperatorTester()
3902     .input_size(24, 25)
3903     .kernel_size(1, 1)
3904     .groups(2)
3905     .group_input_channels(17)
3906     .group_output_channels(19)
3907     .iterations(3)
3908     .TestNHWCxF32();
3909 }
3910 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1_with_qmin)3911 TEST(CONVOLUTION_NHWC_F32, grouped_1x1_with_qmin) {
3912   ConvolutionOperatorTester()
3913     .input_size(24, 25)
3914     .kernel_size(1, 1)
3915     .groups(2)
3916     .group_input_channels(17)
3917     .group_output_channels(19)
3918     .qmin(128)
3919     .iterations(3)
3920     .TestNHWCxF32();
3921 }
3922 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1_with_qmax)3923 TEST(CONVOLUTION_NHWC_F32, grouped_1x1_with_qmax) {
3924   ConvolutionOperatorTester()
3925     .input_size(24, 25)
3926     .kernel_size(1, 1)
3927     .groups(2)
3928     .group_input_channels(17)
3929     .group_output_channels(19)
3930     .qmax(128)
3931     .iterations(3)
3932     .TestNHWCxF32();
3933 }
3934 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1_with_input_stride)3935 TEST(CONVOLUTION_NHWC_F32, grouped_1x1_with_input_stride) {
3936   ConvolutionOperatorTester()
3937     .input_size(24, 25)
3938     .kernel_size(1, 1)
3939     .groups(2)
3940     .input_channel_stride(37)
3941     .group_input_channels(17)
3942     .group_output_channels(19)
3943     .iterations(3)
3944     .TestNHWCxF32();
3945 }
3946 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1_with_output_stride)3947 TEST(CONVOLUTION_NHWC_F32, grouped_1x1_with_output_stride) {
3948   ConvolutionOperatorTester()
3949     .input_size(24, 25)
3950     .kernel_size(1, 1)
3951     .groups(2)
3952     .output_channel_stride(41)
3953     .group_input_channels(17)
3954     .group_output_channels(19)
3955     .iterations(3)
3956     .TestNHWCxF32();
3957 }
3958 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1_without_bias)3959 TEST(CONVOLUTION_NHWC_F32, grouped_1x1_without_bias) {
3960   ConvolutionOperatorTester()
3961     .has_bias(false)
3962     .input_size(24, 25)
3963     .kernel_size(1, 1)
3964     .groups(2)
3965     .group_input_channels(17)
3966     .group_output_channels(19)
3967     .iterations(3)
3968     .TestNHWCxF32();
3969 }
3970 
TEST(CONVOLUTION_NHWC_F32,grouped_1x1_with_batch)3971 TEST(CONVOLUTION_NHWC_F32, grouped_1x1_with_batch) {
3972   ConvolutionOperatorTester()
3973     .batch_size(3)
3974     .input_size(24, 25)
3975     .kernel_size(1, 1)
3976     .groups(2)
3977     .group_input_channels(17)
3978     .group_output_channels(19)
3979     .iterations(3)
3980     .TestNHWCxF32();
3981 }
3982 
TEST(CONVOLUTION_NHWC_F32,unioutput_1x1)3983 TEST(CONVOLUTION_NHWC_F32, unioutput_1x1) {
3984   ConvolutionOperatorTester()
3985     .input_size(1, 1)
3986     .kernel_size(1, 1)
3987     .group_input_channels(23)
3988     .group_output_channels(19)
3989     .iterations(3)
3990     .TestNHWCxF32();
3991 }
3992 
TEST(CONVOLUTION_NHWC_F32,unioutput_1x1_with_qmin)3993 TEST(CONVOLUTION_NHWC_F32, unioutput_1x1_with_qmin) {
3994   ConvolutionOperatorTester()
3995     .input_size(1, 1)
3996     .kernel_size(1, 1)
3997     .group_input_channels(23)
3998     .group_output_channels(19)
3999     .qmin(128)
4000     .iterations(3)
4001     .TestNHWCxF32();
4002 }
4003 
TEST(CONVOLUTION_NHWC_F32,unioutput_1x1_with_qmax)4004 TEST(CONVOLUTION_NHWC_F32, unioutput_1x1_with_qmax) {
4005   ConvolutionOperatorTester()
4006     .input_size(1, 1)
4007     .kernel_size(1, 1)
4008     .group_input_channels(23)
4009     .group_output_channels(19)
4010     .qmax(128)
4011     .iterations(3)
4012     .TestNHWCxF32();
4013 }
4014 
TEST(CONVOLUTION_NHWC_F32,unioutput_1x1_with_input_stride)4015 TEST(CONVOLUTION_NHWC_F32, unioutput_1x1_with_input_stride) {
4016   ConvolutionOperatorTester()
4017     .input_size(1, 1)
4018     .kernel_size(1, 1)
4019     .input_channel_stride(28)
4020     .group_input_channels(23)
4021     .group_output_channels(19)
4022     .iterations(3)
4023     .TestNHWCxF32();
4024 }
4025 
TEST(CONVOLUTION_NHWC_F32,unioutput_1x1_with_output_stride)4026 TEST(CONVOLUTION_NHWC_F32, unioutput_1x1_with_output_stride) {
4027   ConvolutionOperatorTester()
4028     .input_size(1, 1)
4029     .kernel_size(1, 1)
4030     .output_channel_stride(29)
4031     .group_input_channels(23)
4032     .group_output_channels(19)
4033     .iterations(3)
4034     .TestNHWCxF32();
4035 }
4036 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_1x1)4037 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_1x1) {
4038   ConvolutionOperatorTester()
4039     .input_size(1, 1)
4040     .kernel_size(1, 1)
4041     .groups(2)
4042     .group_input_channels(17)
4043     .group_output_channels(13)
4044     .iterations(3)
4045     .TestNHWCxF32();
4046 }
4047 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_1x1_with_qmin)4048 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_1x1_with_qmin) {
4049   ConvolutionOperatorTester()
4050     .input_size(1, 1)
4051     .kernel_size(1, 1)
4052     .groups(2)
4053     .group_input_channels(17)
4054     .group_output_channels(13)
4055     .qmin(128)
4056     .iterations(3)
4057     .TestNHWCxF32();
4058 }
4059 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_1x1_with_qmax)4060 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_1x1_with_qmax) {
4061   ConvolutionOperatorTester()
4062     .input_size(1, 1)
4063     .kernel_size(1, 1)
4064     .groups(2)
4065     .group_input_channels(17)
4066     .group_output_channels(13)
4067     .qmax(128)
4068     .iterations(3)
4069     .TestNHWCxF32();
4070 }
4071 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_1x1_with_input_stride)4072 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_1x1_with_input_stride) {
4073   ConvolutionOperatorTester()
4074     .input_size(1, 1)
4075     .kernel_size(1, 1)
4076     .groups(2)
4077     .input_channel_stride(37)
4078     .group_input_channels(17)
4079     .group_output_channels(13)
4080     .iterations(3)
4081     .TestNHWCxF32();
4082 }
4083 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_1x1_with_output_stride)4084 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_1x1_with_output_stride) {
4085   ConvolutionOperatorTester()
4086     .input_size(1, 1)
4087     .kernel_size(1, 1)
4088     .groups(2)
4089     .output_channel_stride(41)
4090     .group_input_channels(17)
4091     .group_output_channels(13)
4092     .iterations(3)
4093     .TestNHWCxF32();
4094 }
4095 
4096 TEST(CONVOLUTION_NHWC_F32, 1x3) {
4097   ConvolutionOperatorTester()
4098     .input_size(20, 19)
4099     .padding_width(1)
4100     .kernel_size(1, 3)
4101     .group_input_channels(17)
4102     .group_output_channels(15)
4103     .iterations(3)
4104     .TestNHWCxF32();
4105 }
4106 
TEST(CONVOLUTION_NHWC_F32,grouped_1x3)4107 TEST(CONVOLUTION_NHWC_F32, grouped_1x3) {
4108   ConvolutionOperatorTester()
4109     .input_size(20, 19)
4110     .padding_width(1)
4111     .kernel_size(1, 3)
4112     .groups(2)
4113     .group_input_channels(17)
4114     .group_output_channels(15)
4115     .iterations(3)
4116     .TestNHWCxF32();
4117 }
4118 
4119 TEST(CONVOLUTION_NHWC_F32, 3x1) {
4120   ConvolutionOperatorTester()
4121     .input_size(19, 20)
4122     .padding_height(1)
4123     .kernel_size(3, 1)
4124     .group_input_channels(17)
4125     .group_output_channels(15)
4126     .iterations(3)
4127     .TestNHWCxF32();
4128 }
4129 
TEST(CONVOLUTION_NHWC_F32,grouped_3x1)4130 TEST(CONVOLUTION_NHWC_F32, grouped_3x1) {
4131   ConvolutionOperatorTester()
4132     .input_size(19, 20)
4133     .padding_height(1)
4134     .kernel_size(3, 1)
4135     .groups(2)
4136     .group_input_channels(17)
4137     .group_output_channels(15)
4138     .iterations(3)
4139     .TestNHWCxF32();
4140 }
4141 
4142 TEST(CONVOLUTION_NHWC_F32, 3x3) {
4143   ConvolutionOperatorTester()
4144     .input_size(13, 12)
4145     .padding(1)
4146     .kernel_size(3, 3)
4147     .group_input_channels(15)
4148     .group_output_channels(17)
4149     .iterations(3)
4150     .TestNHWCxF32();
4151 }
4152 
4153 TEST(CONVOLUTION_NHWC_F32, 3x3_without_padding) {
4154   ConvolutionOperatorTester()
4155     .input_size(13, 12)
4156     .kernel_size(3, 3)
4157     .group_input_channels(15)
4158     .group_output_channels(17)
4159     .iterations(3)
4160     .TestNHWCxF32();
4161 }
4162 
4163 TEST(CONVOLUTION_NHWC_F32, 3x3_with_left_padding) {
4164   ConvolutionOperatorTester()
4165     .input_size(13, 12)
4166     .padding_left(1)
4167     .kernel_size(3, 3)
4168     .group_input_channels(15)
4169     .group_output_channels(17)
4170     .iterations(3)
4171     .TestNHWCxF32();
4172 }
4173 
4174 TEST(CONVOLUTION_NHWC_F32, 3x3_with_right_padding) {
4175   ConvolutionOperatorTester()
4176     .input_size(13, 12)
4177     .padding_right(1)
4178     .kernel_size(3, 3)
4179     .group_input_channels(15)
4180     .group_output_channels(17)
4181     .iterations(3)
4182     .TestNHWCxF32();
4183 }
4184 
4185 TEST(CONVOLUTION_NHWC_F32, 3x3_with_top_padding) {
4186   ConvolutionOperatorTester()
4187     .input_size(13, 12)
4188     .padding_top(1)
4189     .kernel_size(3, 3)
4190     .group_input_channels(15)
4191     .group_output_channels(17)
4192     .iterations(3)
4193     .TestNHWCxF32();
4194 }
4195 
4196 TEST(CONVOLUTION_NHWC_F32, 3x3_with_bottom_padding) {
4197   ConvolutionOperatorTester()
4198     .input_size(13, 12)
4199     .padding_bottom(1)
4200     .kernel_size(3, 3)
4201     .group_input_channels(15)
4202     .group_output_channels(17)
4203     .iterations(3)
4204     .TestNHWCxF32();
4205 }
4206 
4207 TEST(CONVOLUTION_NHWC_F32, 3x3_with_input_stride) {
4208   ConvolutionOperatorTester()
4209     .input_size(13, 12)
4210     .padding(1)
4211     .kernel_size(3, 3)
4212     .input_channel_stride(22)
4213     .group_input_channels(15)
4214     .group_output_channels(17)
4215     .iterations(3)
4216     .TestNHWCxF32();
4217 }
4218 
4219 TEST(CONVOLUTION_NHWC_F32, 3x3_with_output_stride) {
4220   ConvolutionOperatorTester()
4221     .input_size(13, 12)
4222     .padding(1)
4223     .kernel_size(3, 3)
4224     .output_channel_stride(23)
4225     .group_input_channels(15)
4226     .group_output_channels(17)
4227     .iterations(3)
4228     .TestNHWCxF32();
4229 }
4230 
4231 TEST(CONVOLUTION_NHWC_F32, 3x3_without_bias) {
4232   ConvolutionOperatorTester()
4233     .has_bias(false)
4234     .input_size(10, 9)
4235     .padding(1)
4236     .kernel_size(3, 3)
4237     .group_input_channels(15)
4238     .group_output_channels(17)
4239     .iterations(3)
4240     .TestNHWCxF32();
4241 }
4242 
4243 TEST(CONVOLUTION_NHWC_F32, 3x3_with_batch) {
4244   ConvolutionOperatorTester()
4245     .batch_size(3)
4246     .input_size(10, 9)
4247     .padding(1)
4248     .kernel_size(3, 3)
4249     .group_input_channels(15)
4250     .group_output_channels(17)
4251     .iterations(3)
4252     .TestNHWCxF32();
4253 }
4254 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3)4255 TEST(CONVOLUTION_NHWC_F32, grouped_3x3) {
4256   ConvolutionOperatorTester()
4257     .input_size(10, 11)
4258     .padding(1)
4259     .kernel_size(3, 3)
4260     .groups(2)
4261     .group_input_channels(14)
4262     .group_output_channels(13)
4263     .iterations(3)
4264     .TestNHWCxF32();
4265 }
4266 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_without_padding)4267 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_without_padding) {
4268   ConvolutionOperatorTester()
4269     .input_size(13, 12)
4270     .kernel_size(3, 3)
4271     .group_input_channels(15)
4272     .group_output_channels(17)
4273     .iterations(3)
4274     .TestNHWCxF32();
4275 }
4276 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_left_padding)4277 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_left_padding) {
4278   ConvolutionOperatorTester()
4279     .input_size(10, 11)
4280     .padding_left(1)
4281     .kernel_size(3, 3)
4282     .groups(2)
4283     .group_input_channels(14)
4284     .group_output_channels(13)
4285     .iterations(3)
4286     .TestNHWCxF32();
4287 }
4288 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_right_padding)4289 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_right_padding) {
4290   ConvolutionOperatorTester()
4291     .input_size(10, 11)
4292     .padding_right(1)
4293     .kernel_size(3, 3)
4294     .groups(2)
4295     .group_input_channels(14)
4296     .group_output_channels(13)
4297     .iterations(3)
4298     .TestNHWCxF32();
4299 }
4300 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_top_padding)4301 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_top_padding) {
4302   ConvolutionOperatorTester()
4303     .input_size(10, 11)
4304     .padding_top(1)
4305     .kernel_size(3, 3)
4306     .groups(2)
4307     .group_input_channels(14)
4308     .group_output_channels(13)
4309     .iterations(3)
4310     .TestNHWCxF32();
4311 }
4312 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_bottom_padding)4313 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_bottom_padding) {
4314   ConvolutionOperatorTester()
4315     .input_size(10, 11)
4316     .padding_bottom(1)
4317     .kernel_size(3, 3)
4318     .groups(2)
4319     .group_input_channels(14)
4320     .group_output_channels(13)
4321     .iterations(3)
4322     .TestNHWCxF32();
4323 }
4324 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_input_stride)4325 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_input_stride) {
4326   ConvolutionOperatorTester()
4327     .input_size(10, 11)
4328     .padding(1)
4329     .kernel_size(3, 3)
4330     .groups(2)
4331     .input_channel_stride(29)
4332     .group_input_channels(14)
4333     .group_output_channels(13)
4334     .iterations(3)
4335     .TestNHWCxF32();
4336 }
4337 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_output_stride)4338 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_output_stride) {
4339   ConvolutionOperatorTester()
4340     .input_size(10, 11)
4341     .padding(1)
4342     .kernel_size(3, 3)
4343     .groups(2)
4344     .output_channel_stride(31)
4345     .group_input_channels(14)
4346     .group_output_channels(13)
4347     .iterations(3)
4348     .TestNHWCxF32();
4349 }
4350 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_without_bias)4351 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_without_bias) {
4352   ConvolutionOperatorTester()
4353     .has_bias(false)
4354     .input_size(10, 11)
4355     .padding(1)
4356     .kernel_size(3, 3)
4357     .groups(2)
4358     .group_input_channels(14)
4359     .group_output_channels(13)
4360     .iterations(3)
4361     .TestNHWCxF32();
4362 }
4363 
TEST(CONVOLUTION_NHWC_F32,grouped_3x3_with_batch)4364 TEST(CONVOLUTION_NHWC_F32, grouped_3x3_with_batch) {
4365   ConvolutionOperatorTester()
4366     .batch_size(3)
4367     .input_size(10, 11)
4368     .padding(1)
4369     .kernel_size(3, 3)
4370     .groups(2)
4371     .group_input_channels(14)
4372     .group_output_channels(13)
4373     .iterations(3)
4374     .TestNHWCxF32();
4375 }
4376 
4377 TEST(CONVOLUTION_NHWC_F32, 3x3s2) {
4378   ConvolutionOperatorTester()
4379     .input_size(14, 13)
4380     .padding(1)
4381     .kernel_size(3, 3)
4382     .subsampling(2)
4383     .group_input_channels(27)
4384     .group_output_channels(19)
4385     .iterations(3)
4386     .TestNHWCxF32();
4387 }
4388 
4389 TEST(CONVOLUTION_NHWC_F32, 3x3s2_with_tf_same_padding) {
4390   for (size_t input_height = 13; input_height <= 14; input_height++) {
4391     for (size_t input_width = 13; input_width <= 14; input_width++) {
4392       ConvolutionOperatorTester()
4393         .input_size(input_height, input_width)
4394         .padding_tf_same(true)
4395         .kernel_size(3, 3)
4396         .subsampling(2)
4397         .group_input_channels(27)
4398         .group_output_channels(19)
4399         .iterations(3)
4400         .TestNHWCxF32();
4401     }
4402   }
4403 }
4404 
4405 TEST(CONVOLUTION_NHWC_F32, 3x3s1x2) {
4406   ConvolutionOperatorTester()
4407     .input_size(14, 13)
4408     .padding(1)
4409     .kernel_size(3, 3)
4410     .subsampling(1, 2)
4411     .group_input_channels(27)
4412     .group_output_channels(19)
4413     .iterations(3)
4414     .TestNHWCxF32();
4415 }
4416 
4417 TEST(CONVOLUTION_NHWC_F32, 3x3s1x2_with_tf_same_padding) {
4418   for (size_t input_height = 13; input_height <= 14; input_height++) {
4419     for (size_t input_width = 13; input_width <= 14; input_width++) {
4420       ConvolutionOperatorTester()
4421         .input_size(input_height, input_width)
4422         .padding_tf_same(true)
4423         .kernel_size(3, 3)
4424         .subsampling(1, 2)
4425         .group_input_channels(27)
4426         .group_output_channels(19)
4427         .iterations(3)
4428         .TestNHWCxF32();
4429     }
4430   }
4431 }
4432 
4433 TEST(CONVOLUTION_NHWC_F32, 3x3s2x1) {
4434   ConvolutionOperatorTester()
4435     .input_size(14, 13)
4436     .padding(1)
4437     .kernel_size(3, 3)
4438     .subsampling(2, 1)
4439     .group_input_channels(27)
4440     .group_output_channels(19)
4441     .iterations(3)
4442     .TestNHWCxF32();
4443 }
4444 
4445 TEST(CONVOLUTION_NHWC_F32, 3x3s2x1_with_tf_same_padding) {
4446   for (size_t input_height = 13; input_height <= 14; input_height++) {
4447     for (size_t input_width = 13; input_width <= 14; input_width++) {
4448       ConvolutionOperatorTester()
4449         .input_size(input_height, input_width)
4450         .padding_tf_same(true)
4451         .kernel_size(3, 3)
4452         .subsampling(2, 1)
4453         .group_input_channels(27)
4454         .group_output_channels(19)
4455         .iterations(3)
4456         .TestNHWCxF32();
4457     }
4458   }
4459 }
4460 
4461 TEST(CONVOLUTION_NHWC_F32, 3x3d2) {
4462   ConvolutionOperatorTester()
4463     .input_size(13, 14)
4464     .padding(2)
4465     .kernel_size(3, 3)
4466     .dilation(2)
4467     .group_input_channels(27)
4468     .group_output_channels(19)
4469     .iterations(3)
4470     .TestNHWCxF32();
4471 }
4472 
4473 TEST(CONVOLUTION_NHWC_F32, 3x3d1x2) {
4474   ConvolutionOperatorTester()
4475     .input_size(14, 15)
4476     .padding(1, 2)
4477     .kernel_size(3, 3)
4478     .dilation(1, 2)
4479     .group_input_channels(27)
4480     .group_output_channels(19)
4481     .iterations(3)
4482     .TestNHWCxF32();
4483 }
4484 
4485 TEST(CONVOLUTION_NHWC_F32, 3x3d2x1) {
4486   ConvolutionOperatorTester()
4487     .input_size(15, 14)
4488     .padding(2, 1)
4489     .kernel_size(3, 3)
4490     .dilation(2, 1)
4491     .group_input_channels(27)
4492     .group_output_channels(19)
4493     .iterations(3)
4494     .TestNHWCxF32();
4495 }
4496 
TEST(CONVOLUTION_NHWC_F32,unioutput_3x3)4497 TEST(CONVOLUTION_NHWC_F32, unioutput_3x3) {
4498   ConvolutionOperatorTester()
4499     .input_size(3, 3)
4500     .padding(1)
4501     .kernel_size(3, 3)
4502     .group_input_channels(23)
4503     .group_output_channels(19)
4504     .iterations(3)
4505     .TestNHWCxF32();
4506 }
4507 
TEST(CONVOLUTION_NHWC_F32,unioutput_3x3_with_qmin)4508 TEST(CONVOLUTION_NHWC_F32, unioutput_3x3_with_qmin) {
4509   ConvolutionOperatorTester()
4510     .input_size(3, 3)
4511     .padding(1)
4512     .kernel_size(3, 3)
4513     .group_input_channels(23)
4514     .group_output_channels(19)
4515     .qmin(128)
4516     .iterations(3)
4517     .TestNHWCxF32();
4518 }
4519 
TEST(CONVOLUTION_NHWC_F32,unioutput_3x3_with_qmax)4520 TEST(CONVOLUTION_NHWC_F32, unioutput_3x3_with_qmax) {
4521   ConvolutionOperatorTester()
4522     .input_size(3, 3)
4523     .padding(1)
4524     .kernel_size(3, 3)
4525     .group_input_channels(23)
4526     .group_output_channels(19)
4527     .qmax(128)
4528     .iterations(3)
4529     .TestNHWCxF32();
4530 }
4531 
TEST(CONVOLUTION_NHWC_F32,unioutput_3x3_with_input_stride)4532 TEST(CONVOLUTION_NHWC_F32, unioutput_3x3_with_input_stride) {
4533   ConvolutionOperatorTester()
4534     .input_size(3, 3)
4535     .padding(1)
4536     .kernel_size(3, 3)
4537     .input_channel_stride(28)
4538     .group_input_channels(23)
4539     .group_output_channels(19)
4540     .iterations(3)
4541     .TestNHWCxF32();
4542 }
4543 
TEST(CONVOLUTION_NHWC_F32,unioutput_3x3_with_output_stride)4544 TEST(CONVOLUTION_NHWC_F32, unioutput_3x3_with_output_stride) {
4545   ConvolutionOperatorTester()
4546     .input_size(3, 3)
4547     .padding(1)
4548     .kernel_size(3, 3)
4549     .output_channel_stride(29)
4550     .group_input_channels(23)
4551     .group_output_channels(19)
4552     .iterations(3)
4553     .TestNHWCxF32();
4554 }
4555 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_3x3)4556 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_3x3) {
4557   ConvolutionOperatorTester()
4558     .input_size(3, 3)
4559     .padding(1)
4560     .kernel_size(3, 3)
4561     .groups(2)
4562     .group_input_channels(17)
4563     .group_output_channels(13)
4564     .iterations(3)
4565     .TestNHWCxF32();
4566 }
4567 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_3x3_with_qmin)4568 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_3x3_with_qmin) {
4569   ConvolutionOperatorTester()
4570     .input_size(3, 3)
4571     .padding(1)
4572     .kernel_size(3, 3)
4573     .groups(2)
4574     .group_input_channels(17)
4575     .group_output_channels(13)
4576     .qmin(128)
4577     .iterations(3)
4578     .TestNHWCxF32();
4579 }
4580 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_3x3_with_qmax)4581 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_3x3_with_qmax) {
4582   ConvolutionOperatorTester()
4583     .input_size(3, 3)
4584     .padding(1)
4585     .kernel_size(3, 3)
4586     .groups(2)
4587     .group_input_channels(17)
4588     .group_output_channels(13)
4589     .qmax(128)
4590     .iterations(3)
4591     .TestNHWCxF32();
4592 }
4593 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_3x3_with_input_stride)4594 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_3x3_with_input_stride) {
4595   ConvolutionOperatorTester()
4596     .input_size(3, 3)
4597     .padding(1)
4598     .kernel_size(3, 3)
4599     .groups(2)
4600     .input_channel_stride(37)
4601     .group_input_channels(17)
4602     .group_output_channels(13)
4603     .iterations(3)
4604     .TestNHWCxF32();
4605 }
4606 
TEST(CONVOLUTION_NHWC_F32,unioutput_grouped_3x3_with_output_stride)4607 TEST(CONVOLUTION_NHWC_F32, unioutput_grouped_3x3_with_output_stride) {
4608   ConvolutionOperatorTester()
4609     .input_size(3, 3)
4610     .padding(1)
4611     .kernel_size(3, 3)
4612     .groups(2)
4613     .output_channel_stride(41)
4614     .group_input_channels(17)
4615     .group_output_channels(13)
4616     .iterations(3)
4617     .TestNHWCxF32();
4618 }
4619 
TEST(CONVOLUTION_NHWC_F32,depthwise_1x1)4620 TEST(CONVOLUTION_NHWC_F32, depthwise_1x1) {
4621   ConvolutionOperatorTester()
4622     .input_size(15, 14)
4623     .kernel_size(1, 1)
4624     .groups(24)
4625     .iterations(3)
4626     .TestNHWCxF32();
4627 }
4628 
TEST(CONVOLUTION_NHWC_F32,depthwise_1x1_without_bias)4629 TEST(CONVOLUTION_NHWC_F32, depthwise_1x1_without_bias) {
4630   ConvolutionOperatorTester()
4631     .has_bias(false)
4632     .input_size(15, 14)
4633     .kernel_size(1, 1)
4634     .groups(24)
4635     .iterations(3)
4636     .TestNHWCxF32();
4637 }
4638 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2)4639 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2) {
4640   ConvolutionOperatorTester()
4641     .input_size(15, 14)
4642     .padding(1, 1)
4643     .kernel_size(2, 2)
4644     .groups(24)
4645     .iterations(3)
4646     .TestNHWCxF32();
4647 }
4648 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2_without_bias)4649 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2_without_bias) {
4650   ConvolutionOperatorTester()
4651     .has_bias(false)
4652     .input_size(15, 14)
4653     .padding(1, 1)
4654     .kernel_size(2, 2)
4655     .groups(24)
4656     .iterations(3)
4657     .TestNHWCxF32();
4658 }
4659 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2s2)4660 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2s2) {
4661   ConvolutionOperatorTester()
4662     .input_size(15, 14)
4663     .padding(1, 1)
4664     .kernel_size(2, 2)
4665     .subsampling(2)
4666     .groups(27)
4667     .iterations(3)
4668     .TestNHWCxF32();
4669 }
4670 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2s1x2)4671 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2s1x2) {
4672   ConvolutionOperatorTester()
4673     .input_size(15, 14)
4674     .padding(1, 1)
4675     .kernel_size(2, 2)
4676     .subsampling(1, 2)
4677     .groups(27)
4678     .iterations(3)
4679     .TestNHWCxF32();
4680 }
4681 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2s2x1)4682 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2s2x1) {
4683   ConvolutionOperatorTester()
4684     .input_size(15, 14)
4685     .padding(1, 1)
4686     .kernel_size(2, 2)
4687     .subsampling(2, 1)
4688     .groups(27)
4689     .iterations(3)
4690     .TestNHWCxF32();
4691 }
4692 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2d2)4693 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2d2) {
4694   ConvolutionOperatorTester()
4695     .input_size(15, 14)
4696     .padding(1, 1)
4697     .kernel_size(2, 2)
4698     .dilation(2)
4699     .groups(27)
4700     .iterations(3)
4701     .TestNHWCxF32();
4702 }
4703 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2d1x2)4704 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2d1x2) {
4705   ConvolutionOperatorTester()
4706     .input_size(15, 14)
4707     .padding(1, 1)
4708     .kernel_size(2, 2)
4709     .dilation(1, 2)
4710     .groups(27)
4711     .iterations(3)
4712     .TestNHWCxF32();
4713 }
4714 
TEST(CONVOLUTION_NHWC_F32,depthwise_2x2d2x1)4715 TEST(CONVOLUTION_NHWC_F32, depthwise_2x2d2x1) {
4716   ConvolutionOperatorTester()
4717     .input_size(15, 14)
4718     .padding(1, 1)
4719     .kernel_size(2, 2)
4720     .dilation(2, 1)
4721     .groups(27)
4722     .iterations(3)
4723     .TestNHWCxF32();
4724 }
4725 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3)4726 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3) {
4727   ConvolutionOperatorTester()
4728     .input_size(15, 14)
4729     .padding(1, 1)
4730     .kernel_size(3, 3)
4731     .groups(24)
4732     .iterations(3)
4733     .TestNHWCxF32();
4734 }
4735 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3_without_bias)4736 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3_without_bias) {
4737   ConvolutionOperatorTester()
4738     .has_bias(false)
4739     .input_size(15, 14)
4740     .padding(1, 1)
4741     .kernel_size(3, 3)
4742     .groups(24)
4743     .iterations(3)
4744     .TestNHWCxF32();
4745 }
4746 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3s2)4747 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3s2) {
4748   ConvolutionOperatorTester()
4749     .input_size(15, 14)
4750     .padding(1, 1)
4751     .kernel_size(3, 3)
4752     .subsampling(2)
4753     .groups(27)
4754     .iterations(3)
4755     .TestNHWCxF32();
4756 }
4757 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3s2_with_tf_same_padding)4758 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3s2_with_tf_same_padding) {
4759   for (size_t input_height = 14; input_height <= 15; input_height++) {
4760     for (size_t input_width = 14; input_width <= 15; input_width++) {
4761       ConvolutionOperatorTester()
4762         .input_size(input_height, input_width)
4763         .padding_tf_same(true)
4764         .kernel_size(3, 3)
4765         .subsampling(2)
4766         .groups(27)
4767         .iterations(3)
4768         .TestNHWCxF32();
4769     }
4770   }
4771 }
4772 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3s1x2)4773 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3s1x2) {
4774   ConvolutionOperatorTester()
4775     .input_size(15, 14)
4776     .padding(1, 1)
4777     .kernel_size(3, 3)
4778     .subsampling(1, 2)
4779     .groups(27)
4780     .iterations(3)
4781     .TestNHWCxF32();
4782 }
4783 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3s1x2_with_tf_same_padding)4784 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3s1x2_with_tf_same_padding) {
4785   for (size_t input_height = 14; input_height <= 15; input_height++) {
4786     for (size_t input_width = 14; input_width <= 15; input_width++) {
4787       ConvolutionOperatorTester()
4788         .input_size(input_height, input_width)
4789         .padding_tf_same(true)
4790         .kernel_size(3, 3)
4791         .subsampling(1, 2)
4792         .groups(27)
4793         .iterations(3)
4794         .TestNHWCxF32();
4795     }
4796   }
4797 }
4798 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3s2x1)4799 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3s2x1) {
4800   ConvolutionOperatorTester()
4801     .input_size(15, 14)
4802     .padding(1, 1)
4803     .kernel_size(3, 3)
4804     .subsampling(2, 1)
4805     .groups(27)
4806     .iterations(3)
4807     .TestNHWCxF32();
4808 }
4809 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3s2x1_with_tf_same_padding)4810 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3s2x1_with_tf_same_padding) {
4811   for (size_t input_height = 14; input_height <= 15; input_height++) {
4812     for (size_t input_width = 14; input_width <= 15; input_width++) {
4813       ConvolutionOperatorTester()
4814         .input_size(input_height, input_width)
4815         .padding_tf_same(true)
4816         .kernel_size(3, 3)
4817         .subsampling(2, 1)
4818         .groups(27)
4819         .iterations(3)
4820         .TestNHWCxF32();
4821     }
4822   }
4823 }
4824 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3d2)4825 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3d2) {
4826   ConvolutionOperatorTester()
4827     .input_size(15, 14)
4828     .padding(1, 1)
4829     .kernel_size(3, 3)
4830     .dilation(2)
4831     .groups(27)
4832     .iterations(3)
4833     .TestNHWCxF32();
4834 }
4835 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3d1x2)4836 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3d1x2) {
4837   ConvolutionOperatorTester()
4838     .input_size(15, 14)
4839     .padding(1, 1)
4840     .kernel_size(3, 3)
4841     .dilation(1, 2)
4842     .groups(27)
4843     .iterations(3)
4844     .TestNHWCxF32();
4845 }
4846 
TEST(CONVOLUTION_NHWC_F32,depthwise_3x3d2x1)4847 TEST(CONVOLUTION_NHWC_F32, depthwise_3x3d2x1) {
4848   ConvolutionOperatorTester()
4849     .input_size(15, 14)
4850     .padding(1, 1)
4851     .kernel_size(3, 3)
4852     .dilation(2, 1)
4853     .groups(27)
4854     .iterations(3)
4855     .TestNHWCxF32();
4856 }
4857 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5)4858 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5) {
4859   ConvolutionOperatorTester()
4860     .input_size(15, 14)
4861     .padding(2, 2)
4862     .kernel_size(5, 5)
4863     .groups(27)
4864     .iterations(3)
4865     .TestNHWCxF32();
4866 }
4867 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5_without_bias)4868 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5_without_bias) {
4869   ConvolutionOperatorTester()
4870     .has_bias(false)
4871     .input_size(15, 14)
4872     .padding(2, 2)
4873     .kernel_size(5, 5)
4874     .groups(27)
4875     .iterations(3)
4876     .TestNHWCxF32();
4877 }
4878 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5s2)4879 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5s2) {
4880   ConvolutionOperatorTester()
4881     .input_size(15, 14)
4882     .padding(2, 2)
4883     .kernel_size(5, 5)
4884     .subsampling(2)
4885     .groups(27)
4886     .iterations(3)
4887     .TestNHWCxF32();
4888 }
4889 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5s1x2)4890 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5s1x2) {
4891   ConvolutionOperatorTester()
4892     .input_size(15, 14)
4893     .padding(2, 2)
4894     .kernel_size(5, 5)
4895     .subsampling(1, 2)
4896     .groups(27)
4897     .iterations(3)
4898     .TestNHWCxF32();
4899 }
4900 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5s2x1)4901 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5s2x1) {
4902   ConvolutionOperatorTester()
4903     .input_size(15, 14)
4904     .padding(2, 2)
4905     .kernel_size(5, 5)
4906     .subsampling(2, 1)
4907     .groups(27)
4908     .iterations(3)
4909     .TestNHWCxF32();
4910 }
4911 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5d2)4912 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5d2) {
4913   ConvolutionOperatorTester()
4914     .input_size(15, 14)
4915     .padding(2, 2)
4916     .kernel_size(5, 5)
4917     .dilation(2)
4918     .groups(27)
4919     .iterations(3)
4920     .TestNHWCxF32();
4921 }
4922 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5d1x2)4923 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5d1x2) {
4924   ConvolutionOperatorTester()
4925     .input_size(15, 14)
4926     .padding(2, 2)
4927     .kernel_size(5, 5)
4928     .dilation(1, 2)
4929     .groups(27)
4930     .iterations(3)
4931     .TestNHWCxF32();
4932 }
4933 
TEST(CONVOLUTION_NHWC_F32,depthwise_5x5d2x1)4934 TEST(CONVOLUTION_NHWC_F32, depthwise_5x5d2x1) {
4935   ConvolutionOperatorTester()
4936     .input_size(15, 14)
4937     .padding(2, 2)
4938     .kernel_size(5, 5)
4939     .dilation(2, 1)
4940     .groups(27)
4941     .iterations(3)
4942     .TestNHWCxF32();
4943 }
4944 
4945 // Tests GEMM microkernel with weights_cache.
TEST(CONVOLUTION_NHWC_F32,weights_cache_1x1)4946 TEST(CONVOLUTION_NHWC_F32, weights_cache_1x1) {
4947   ConvolutionOperatorTester()
4948     .input_size(27, 29)
4949     .kernel_size(1, 1)
4950     .group_input_channels(23)
4951     .group_output_channels(19)
4952     .use_weights_cache(true)
4953     .iterations(3)
4954     .TestNHWCxF32();
4955 }
4956 
4957 // Tests IGEMM microkernel with weights cache.
TEST(CONVOLUTION_NHWC_F32,weights_cache_3x3)4958 TEST(CONVOLUTION_NHWC_F32, weights_cache_3x3) {
4959   ConvolutionOperatorTester()
4960     .input_size(13, 12)
4961     .padding(1)
4962     .kernel_size(3, 3)
4963     .group_input_channels(15)
4964     .group_output_channels(17)
4965     .use_weights_cache(true)
4966     .iterations(3)
4967     .TestNHWCxF32();
4968 }
4969 
4970 // Tests vmulcaddc microkernel with weights cache.
TEST(CONVOLUTION_NHWC_F32,weights_cache_depthwise_1x1)4971 TEST(CONVOLUTION_NHWC_F32, weights_cache_depthwise_1x1) {
4972   ConvolutionOperatorTester()
4973     .input_size(15, 14)
4974     .kernel_size(1, 1)
4975     .groups(24)
4976     .use_weights_cache(true)
4977     .iterations(3)
4978     .TestNHWCxF32();
4979 }
4980 
4981 // Tests dwconv microkernel with weights cache.
TEST(CONVOLUTION_NHWC_F32,weights_cache_depthwise_2x2d2)4982 TEST(CONVOLUTION_NHWC_F32, weights_cache_depthwise_2x2d2) {
4983   ConvolutionOperatorTester()
4984     .input_size(15, 14)
4985     .padding(1, 1)
4986     .kernel_size(2, 2)
4987     .dilation(2)
4988     .groups(27)
4989     .iterations(3)
4990     .use_weights_cache(true)
4991     .TestNHWCxF32();
4992 }
4993 
4994 
4995 #if XNN_PLATFORM_JIT && XNN_ENABLE_JIT
TEST(CONVOLUTION_NHWC_F32,jit_1x1)4996 TEST(CONVOLUTION_NHWC_F32, jit_1x1) {
4997   ConvolutionOperatorTester()
4998     .input_size(27, 29)
4999     .kernel_size(1, 1)
5000     .group_input_channels(23)
5001     .group_output_channels(19)
5002     .iterations(3)
5003     .use_jit(true)
5004     .TestNHWCxF32();
5005 }
5006 
TEST(CONVOLUTION_NHWC_F32,jit_1x1_with_qmin)5007 TEST(CONVOLUTION_NHWC_F32, jit_1x1_with_qmin) {
5008   ConvolutionOperatorTester()
5009     .input_size(27, 29)
5010     .kernel_size(1, 1)
5011     .group_input_channels(23)
5012     .group_output_channels(19)
5013     .qmin(128)
5014     .iterations(3)
5015     .use_jit(true)
5016     .TestNHWCxF32();
5017 }
5018 
TEST(CONVOLUTION_NHWC_F32,jit_1x1_with_qmax)5019 TEST(CONVOLUTION_NHWC_F32, jit_1x1_with_qmax) {
5020   ConvolutionOperatorTester()
5021     .input_size(27, 29)
5022     .kernel_size(1, 1)
5023     .group_input_channels(23)
5024     .group_output_channels(19)
5025     .qmax(128)
5026     .iterations(3)
5027     .use_jit(true)
5028     .TestNHWCxF32();
5029 }
5030 
TEST(CONVOLUTION_NHWC_F32,jit_1x1_with_input_stride)5031 TEST(CONVOLUTION_NHWC_F32, jit_1x1_with_input_stride) {
5032   ConvolutionOperatorTester()
5033     .input_size(27, 29)
5034     .kernel_size(1, 1)
5035     .input_channel_stride(28)
5036     .group_input_channels(23)
5037     .group_output_channels(19)
5038     .iterations(3)
5039     .use_jit(true)
5040     .TestNHWCxF32();
5041 }
5042 
TEST(CONVOLUTION_NHWC_F32,jit_1x1_with_output_stride)5043 TEST(CONVOLUTION_NHWC_F32, jit_1x1_with_output_stride) {
5044   ConvolutionOperatorTester()
5045     .input_size(27, 29)
5046     .kernel_size(1, 1)
5047     .output_channel_stride(29)
5048     .group_input_channels(23)
5049     .group_output_channels(19)
5050     .iterations(3)
5051     .use_jit(true)
5052     .TestNHWCxF32();
5053 }
5054 
TEST(CONVOLUTION_NHWC_F32,jit_1x1_without_bias)5055 TEST(CONVOLUTION_NHWC_F32, jit_1x1_without_bias) {
5056   ConvolutionOperatorTester()
5057     .has_bias(false)
5058     .input_size(13, 14)
5059     .kernel_size(1, 1)
5060     .group_input_channels(23)
5061     .group_output_channels(19)
5062     .iterations(3)
5063     .use_jit(true)
5064     .TestNHWCxF32();
5065 }
5066 
TEST(CONVOLUTION_NHWC_F32,jit_1x1_with_batch)5067 TEST(CONVOLUTION_NHWC_F32, jit_1x1_with_batch) {
5068   ConvolutionOperatorTester()
5069     .batch_size(3)
5070     .input_size(13, 14)
5071     .kernel_size(1, 1)
5072     .group_input_channels(23)
5073     .group_output_channels(19)
5074     .iterations(3)
5075     .use_jit(true)
5076     .TestNHWCxF32();
5077 }
5078 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1)5079 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1) {
5080   ConvolutionOperatorTester()
5081     .input_size(24, 25)
5082     .kernel_size(1, 1)
5083     .groups(2)
5084     .group_input_channels(17)
5085     .group_output_channels(19)
5086     .iterations(3)
5087     .use_jit(true)
5088     .TestNHWCxF32();
5089 }
5090 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1_with_qmin)5091 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1_with_qmin) {
5092   ConvolutionOperatorTester()
5093     .input_size(24, 25)
5094     .kernel_size(1, 1)
5095     .groups(2)
5096     .group_input_channels(17)
5097     .group_output_channels(19)
5098     .qmin(128)
5099     .iterations(3)
5100     .use_jit(true)
5101     .TestNHWCxF32();
5102 }
5103 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1_with_qmax)5104 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1_with_qmax) {
5105   ConvolutionOperatorTester()
5106     .input_size(24, 25)
5107     .kernel_size(1, 1)
5108     .groups(2)
5109     .group_input_channels(17)
5110     .group_output_channels(19)
5111     .qmax(128)
5112     .iterations(3)
5113     .use_jit(true)
5114     .TestNHWCxF32();
5115 }
5116 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1_with_input_stride)5117 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1_with_input_stride) {
5118   ConvolutionOperatorTester()
5119     .input_size(24, 25)
5120     .kernel_size(1, 1)
5121     .groups(2)
5122     .input_channel_stride(37)
5123     .group_input_channels(17)
5124     .group_output_channels(19)
5125     .iterations(3)
5126     .use_jit(true)
5127     .TestNHWCxF32();
5128 }
5129 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1_with_output_stride)5130 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1_with_output_stride) {
5131   ConvolutionOperatorTester()
5132     .input_size(24, 25)
5133     .kernel_size(1, 1)
5134     .groups(2)
5135     .output_channel_stride(41)
5136     .group_input_channels(17)
5137     .group_output_channels(19)
5138     .iterations(3)
5139     .use_jit(true)
5140     .TestNHWCxF32();
5141 }
5142 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1_without_bias)5143 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1_without_bias) {
5144   ConvolutionOperatorTester()
5145     .has_bias(false)
5146     .input_size(24, 25)
5147     .kernel_size(1, 1)
5148     .groups(2)
5149     .group_input_channels(17)
5150     .group_output_channels(19)
5151     .iterations(3)
5152     .use_jit(true)
5153     .TestNHWCxF32();
5154 }
5155 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x1_with_batch)5156 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x1_with_batch) {
5157   ConvolutionOperatorTester()
5158     .batch_size(3)
5159     .input_size(24, 25)
5160     .kernel_size(1, 1)
5161     .groups(2)
5162     .group_input_channels(17)
5163     .group_output_channels(19)
5164     .iterations(3)
5165     .use_jit(true)
5166     .TestNHWCxF32();
5167 }
5168 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_1x1)5169 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_1x1) {
5170   ConvolutionOperatorTester()
5171     .input_size(1, 1)
5172     .kernel_size(1, 1)
5173     .group_input_channels(23)
5174     .group_output_channels(19)
5175     .iterations(3)
5176     .use_jit(true)
5177     .TestNHWCxF32();
5178 }
5179 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_1x1_with_qmin)5180 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_1x1_with_qmin) {
5181   ConvolutionOperatorTester()
5182     .input_size(1, 1)
5183     .kernel_size(1, 1)
5184     .group_input_channels(23)
5185     .group_output_channels(19)
5186     .qmin(128)
5187     .iterations(3)
5188     .use_jit(true)
5189     .TestNHWCxF32();
5190 }
5191 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_1x1_with_qmax)5192 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_1x1_with_qmax) {
5193   ConvolutionOperatorTester()
5194     .input_size(1, 1)
5195     .kernel_size(1, 1)
5196     .group_input_channels(23)
5197     .group_output_channels(19)
5198     .qmax(128)
5199     .iterations(3)
5200     .use_jit(true)
5201     .TestNHWCxF32();
5202 }
5203 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_1x1_with_input_stride)5204 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_1x1_with_input_stride) {
5205   ConvolutionOperatorTester()
5206     .input_size(1, 1)
5207     .kernel_size(1, 1)
5208     .input_channel_stride(28)
5209     .group_input_channels(23)
5210     .group_output_channels(19)
5211     .iterations(3)
5212     .use_jit(true)
5213     .TestNHWCxF32();
5214 }
5215 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_1x1_with_output_stride)5216 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_1x1_with_output_stride) {
5217   ConvolutionOperatorTester()
5218     .input_size(1, 1)
5219     .kernel_size(1, 1)
5220     .output_channel_stride(29)
5221     .group_input_channels(23)
5222     .group_output_channels(19)
5223     .iterations(3)
5224     .use_jit(true)
5225     .TestNHWCxF32();
5226 }
5227 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_1x1)5228 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_1x1) {
5229   ConvolutionOperatorTester()
5230     .input_size(1, 1)
5231     .kernel_size(1, 1)
5232     .groups(2)
5233     .group_input_channels(17)
5234     .group_output_channels(13)
5235     .iterations(3)
5236     .use_jit(true)
5237     .TestNHWCxF32();
5238 }
5239 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_1x1_with_qmin)5240 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_1x1_with_qmin) {
5241   ConvolutionOperatorTester()
5242     .input_size(1, 1)
5243     .kernel_size(1, 1)
5244     .groups(2)
5245     .group_input_channels(17)
5246     .group_output_channels(13)
5247     .qmin(128)
5248     .iterations(3)
5249     .use_jit(true)
5250     .TestNHWCxF32();
5251 }
5252 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_1x1_with_qmax)5253 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_1x1_with_qmax) {
5254   ConvolutionOperatorTester()
5255     .input_size(1, 1)
5256     .kernel_size(1, 1)
5257     .groups(2)
5258     .group_input_channels(17)
5259     .group_output_channels(13)
5260     .qmax(128)
5261     .iterations(3)
5262     .use_jit(true)
5263     .TestNHWCxF32();
5264 }
5265 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_1x1_with_input_stride)5266 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_1x1_with_input_stride) {
5267   ConvolutionOperatorTester()
5268     .input_size(1, 1)
5269     .kernel_size(1, 1)
5270     .groups(2)
5271     .input_channel_stride(37)
5272     .group_input_channels(17)
5273     .group_output_channels(13)
5274     .iterations(3)
5275     .use_jit(true)
5276     .TestNHWCxF32();
5277 }
5278 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_1x1_with_output_stride)5279 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_1x1_with_output_stride) {
5280   ConvolutionOperatorTester()
5281     .input_size(1, 1)
5282     .kernel_size(1, 1)
5283     .groups(2)
5284     .output_channel_stride(41)
5285     .group_input_channels(17)
5286     .group_output_channels(13)
5287     .iterations(3)
5288     .use_jit(true)
5289     .TestNHWCxF32();
5290 }
5291 
TEST(CONVOLUTION_NHWC_F32,jit_1x3)5292 TEST(CONVOLUTION_NHWC_F32, jit_1x3) {
5293   ConvolutionOperatorTester()
5294     .input_size(20, 19)
5295     .padding_width(1)
5296     .kernel_size(1, 3)
5297     .group_input_channels(17)
5298     .group_output_channels(15)
5299     .iterations(3)
5300     .use_jit(true)
5301     .TestNHWCxF32();
5302 }
5303 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_1x3)5304 TEST(CONVOLUTION_NHWC_F32, jit_grouped_1x3) {
5305   ConvolutionOperatorTester()
5306     .input_size(20, 19)
5307     .padding_width(1)
5308     .kernel_size(1, 3)
5309     .groups(2)
5310     .group_input_channels(17)
5311     .group_output_channels(15)
5312     .iterations(3)
5313     .use_jit(true)
5314     .TestNHWCxF32();
5315 }
5316 
TEST(CONVOLUTION_NHWC_F32,jit_3x1)5317 TEST(CONVOLUTION_NHWC_F32, jit_3x1) {
5318   ConvolutionOperatorTester()
5319     .input_size(19, 20)
5320     .padding_height(1)
5321     .kernel_size(3, 1)
5322     .group_input_channels(17)
5323     .group_output_channels(15)
5324     .iterations(3)
5325     .use_jit(true)
5326     .TestNHWCxF32();
5327 }
5328 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x1)5329 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x1) {
5330   ConvolutionOperatorTester()
5331     .input_size(19, 20)
5332     .padding_height(1)
5333     .kernel_size(3, 1)
5334     .groups(2)
5335     .group_input_channels(17)
5336     .group_output_channels(15)
5337     .iterations(3)
5338     .use_jit(true)
5339     .TestNHWCxF32();
5340 }
5341 
TEST(CONVOLUTION_NHWC_F32,jit_3x3)5342 TEST(CONVOLUTION_NHWC_F32, jit_3x3) {
5343   ConvolutionOperatorTester()
5344     .input_size(13, 12)
5345     .padding(1)
5346     .kernel_size(3, 3)
5347     .group_input_channels(15)
5348     .group_output_channels(17)
5349     .iterations(3)
5350     .use_jit(true)
5351     .TestNHWCxF32();
5352 }
5353 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_without_padding)5354 TEST(CONVOLUTION_NHWC_F32, jit_3x3_without_padding) {
5355   ConvolutionOperatorTester()
5356     .input_size(13, 12)
5357     .kernel_size(3, 3)
5358     .group_input_channels(15)
5359     .group_output_channels(17)
5360     .iterations(3)
5361     .use_jit(true)
5362     .TestNHWCxF32();
5363 }
5364 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_left_padding)5365 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_left_padding) {
5366   ConvolutionOperatorTester()
5367     .input_size(13, 12)
5368     .padding_left(1)
5369     .kernel_size(3, 3)
5370     .group_input_channels(15)
5371     .group_output_channels(17)
5372     .iterations(3)
5373     .use_jit(true)
5374     .TestNHWCxF32();
5375 }
5376 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_right_padding)5377 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_right_padding) {
5378   ConvolutionOperatorTester()
5379     .input_size(13, 12)
5380     .padding_right(1)
5381     .kernel_size(3, 3)
5382     .group_input_channels(15)
5383     .group_output_channels(17)
5384     .iterations(3)
5385     .use_jit(true)
5386     .TestNHWCxF32();
5387 }
5388 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_top_padding)5389 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_top_padding) {
5390   ConvolutionOperatorTester()
5391     .input_size(13, 12)
5392     .padding_top(1)
5393     .kernel_size(3, 3)
5394     .group_input_channels(15)
5395     .group_output_channels(17)
5396     .iterations(3)
5397     .use_jit(true)
5398     .TestNHWCxF32();
5399 }
5400 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_bottom_padding)5401 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_bottom_padding) {
5402   ConvolutionOperatorTester()
5403     .input_size(13, 12)
5404     .padding_bottom(1)
5405     .kernel_size(3, 3)
5406     .group_input_channels(15)
5407     .group_output_channels(17)
5408     .iterations(3)
5409     .use_jit(true)
5410     .TestNHWCxF32();
5411 }
5412 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_input_stride)5413 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_input_stride) {
5414   ConvolutionOperatorTester()
5415     .input_size(13, 12)
5416     .padding(1)
5417     .kernel_size(3, 3)
5418     .input_channel_stride(22)
5419     .group_input_channels(15)
5420     .group_output_channels(17)
5421     .iterations(3)
5422     .use_jit(true)
5423     .TestNHWCxF32();
5424 }
5425 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_output_stride)5426 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_output_stride) {
5427   ConvolutionOperatorTester()
5428     .input_size(13, 12)
5429     .padding(1)
5430     .kernel_size(3, 3)
5431     .output_channel_stride(23)
5432     .group_input_channels(15)
5433     .group_output_channels(17)
5434     .iterations(3)
5435     .use_jit(true)
5436     .TestNHWCxF32();
5437 }
5438 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_without_bias)5439 TEST(CONVOLUTION_NHWC_F32, jit_3x3_without_bias) {
5440   ConvolutionOperatorTester()
5441     .has_bias(false)
5442     .input_size(10, 9)
5443     .padding(1)
5444     .kernel_size(3, 3)
5445     .group_input_channels(15)
5446     .group_output_channels(17)
5447     .iterations(3)
5448     .use_jit(true)
5449     .TestNHWCxF32();
5450 }
5451 
TEST(CONVOLUTION_NHWC_F32,jit_3x3_with_batch)5452 TEST(CONVOLUTION_NHWC_F32, jit_3x3_with_batch) {
5453   ConvolutionOperatorTester()
5454     .batch_size(3)
5455     .input_size(10, 9)
5456     .padding(1)
5457     .kernel_size(3, 3)
5458     .group_input_channels(15)
5459     .group_output_channels(17)
5460     .iterations(3)
5461     .use_jit(true)
5462     .TestNHWCxF32();
5463 }
5464 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3)5465 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3) {
5466   ConvolutionOperatorTester()
5467     .input_size(10, 11)
5468     .padding(1)
5469     .kernel_size(3, 3)
5470     .groups(2)
5471     .group_input_channels(14)
5472     .group_output_channels(13)
5473     .iterations(3)
5474     .use_jit(true)
5475     .TestNHWCxF32();
5476 }
5477 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_without_padding)5478 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_without_padding) {
5479   ConvolutionOperatorTester()
5480     .input_size(13, 12)
5481     .kernel_size(3, 3)
5482     .group_input_channels(15)
5483     .group_output_channels(17)
5484     .iterations(3)
5485     .use_jit(true)
5486     .TestNHWCxF32();
5487 }
5488 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_left_padding)5489 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_left_padding) {
5490   ConvolutionOperatorTester()
5491     .input_size(10, 11)
5492     .padding_left(1)
5493     .kernel_size(3, 3)
5494     .groups(2)
5495     .group_input_channels(14)
5496     .group_output_channels(13)
5497     .iterations(3)
5498     .use_jit(true)
5499     .TestNHWCxF32();
5500 }
5501 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_right_padding)5502 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_right_padding) {
5503   ConvolutionOperatorTester()
5504     .input_size(10, 11)
5505     .padding_right(1)
5506     .kernel_size(3, 3)
5507     .groups(2)
5508     .group_input_channels(14)
5509     .group_output_channels(13)
5510     .iterations(3)
5511     .use_jit(true)
5512     .TestNHWCxF32();
5513 }
5514 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_top_padding)5515 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_top_padding) {
5516   ConvolutionOperatorTester()
5517     .input_size(10, 11)
5518     .padding_top(1)
5519     .kernel_size(3, 3)
5520     .groups(2)
5521     .group_input_channels(14)
5522     .group_output_channels(13)
5523     .iterations(3)
5524     .use_jit(true)
5525     .TestNHWCxF32();
5526 }
5527 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_bottom_padding)5528 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_bottom_padding) {
5529   ConvolutionOperatorTester()
5530     .input_size(10, 11)
5531     .padding_bottom(1)
5532     .kernel_size(3, 3)
5533     .groups(2)
5534     .group_input_channels(14)
5535     .group_output_channels(13)
5536     .iterations(3)
5537     .use_jit(true)
5538     .TestNHWCxF32();
5539 }
5540 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_input_stride)5541 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_input_stride) {
5542   ConvolutionOperatorTester()
5543     .input_size(10, 11)
5544     .padding(1)
5545     .kernel_size(3, 3)
5546     .groups(2)
5547     .input_channel_stride(29)
5548     .group_input_channels(14)
5549     .group_output_channels(13)
5550     .iterations(3)
5551     .use_jit(true)
5552     .TestNHWCxF32();
5553 }
5554 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_output_stride)5555 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_output_stride) {
5556   ConvolutionOperatorTester()
5557     .input_size(10, 11)
5558     .padding(1)
5559     .kernel_size(3, 3)
5560     .groups(2)
5561     .output_channel_stride(31)
5562     .group_input_channels(14)
5563     .group_output_channels(13)
5564     .iterations(3)
5565     .use_jit(true)
5566     .TestNHWCxF32();
5567 }
5568 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_without_bias)5569 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_without_bias) {
5570   ConvolutionOperatorTester()
5571     .has_bias(false)
5572     .input_size(10, 11)
5573     .padding(1)
5574     .kernel_size(3, 3)
5575     .groups(2)
5576     .group_input_channels(14)
5577     .group_output_channels(13)
5578     .iterations(3)
5579     .use_jit(true)
5580     .TestNHWCxF32();
5581 }
5582 
TEST(CONVOLUTION_NHWC_F32,jit_grouped_3x3_with_batch)5583 TEST(CONVOLUTION_NHWC_F32, jit_grouped_3x3_with_batch) {
5584   ConvolutionOperatorTester()
5585     .batch_size(3)
5586     .input_size(10, 11)
5587     .padding(1)
5588     .kernel_size(3, 3)
5589     .groups(2)
5590     .group_input_channels(14)
5591     .group_output_channels(13)
5592     .iterations(3)
5593     .use_jit(true)
5594     .TestNHWCxF32();
5595 }
5596 
TEST(CONVOLUTION_NHWC_F32,jit_3x3s2)5597 TEST(CONVOLUTION_NHWC_F32, jit_3x3s2) {
5598   ConvolutionOperatorTester()
5599     .input_size(14, 13)
5600     .padding(1)
5601     .kernel_size(3, 3)
5602     .subsampling(2)
5603     .group_input_channels(27)
5604     .group_output_channels(19)
5605     .iterations(3)
5606     .use_jit(true)
5607     .TestNHWCxF32();
5608 }
5609 
TEST(CONVOLUTION_NHWC_F32,jit_3x3s2_with_tf_same_padding)5610 TEST(CONVOLUTION_NHWC_F32, jit_3x3s2_with_tf_same_padding) {
5611   for (size_t input_height = 13; input_height <= 14; input_height++) {
5612     for (size_t input_width = 13; input_width <= 14; input_width++) {
5613       ConvolutionOperatorTester()
5614         .input_size(input_height, input_width)
5615         .padding_tf_same(true)
5616         .kernel_size(3, 3)
5617         .subsampling(2)
5618         .group_input_channels(27)
5619         .group_output_channels(19)
5620         .iterations(3)
5621         .use_jit(true)
5622         .TestNHWCxF32();
5623     }
5624   }
5625 }
5626 
TEST(CONVOLUTION_NHWC_F32,jit_3x3s1x2)5627 TEST(CONVOLUTION_NHWC_F32, jit_3x3s1x2) {
5628   ConvolutionOperatorTester()
5629     .input_size(14, 13)
5630     .padding(1)
5631     .kernel_size(3, 3)
5632     .subsampling(1, 2)
5633     .group_input_channels(27)
5634     .group_output_channels(19)
5635     .iterations(3)
5636     .use_jit(true)
5637     .TestNHWCxF32();
5638 }
5639 
TEST(CONVOLUTION_NHWC_F32,jit_3x3s1x2_with_tf_same_padding)5640 TEST(CONVOLUTION_NHWC_F32, jit_3x3s1x2_with_tf_same_padding) {
5641   for (size_t input_height = 13; input_height <= 14; input_height++) {
5642     for (size_t input_width = 13; input_width <= 14; input_width++) {
5643       ConvolutionOperatorTester()
5644         .input_size(input_height, input_width)
5645         .padding_tf_same(true)
5646         .kernel_size(3, 3)
5647         .subsampling(1, 2)
5648         .group_input_channels(27)
5649         .group_output_channels(19)
5650         .iterations(3)
5651         .use_jit(true)
5652         .TestNHWCxF32();
5653     }
5654   }
5655 }
5656 
TEST(CONVOLUTION_NHWC_F32,jit_3x3s2x1)5657 TEST(CONVOLUTION_NHWC_F32, jit_3x3s2x1) {
5658   ConvolutionOperatorTester()
5659     .input_size(14, 13)
5660     .padding(1)
5661     .kernel_size(3, 3)
5662     .subsampling(2, 1)
5663     .group_input_channels(27)
5664     .group_output_channels(19)
5665     .iterations(3)
5666     .use_jit(true)
5667     .TestNHWCxF32();
5668 }
5669 
TEST(CONVOLUTION_NHWC_F32,jit_3x3s2x1_with_tf_same_padding)5670 TEST(CONVOLUTION_NHWC_F32, jit_3x3s2x1_with_tf_same_padding) {
5671   for (size_t input_height = 13; input_height <= 14; input_height++) {
5672     for (size_t input_width = 13; input_width <= 14; input_width++) {
5673       ConvolutionOperatorTester()
5674         .input_size(input_height, input_width)
5675         .padding_tf_same(true)
5676         .kernel_size(3, 3)
5677         .subsampling(2, 1)
5678         .group_input_channels(27)
5679         .group_output_channels(19)
5680         .iterations(3)
5681         .use_jit(true)
5682         .TestNHWCxF32();
5683     }
5684   }
5685 }
5686 
TEST(CONVOLUTION_NHWC_F32,jit_3x3d2)5687 TEST(CONVOLUTION_NHWC_F32, jit_3x3d2) {
5688   ConvolutionOperatorTester()
5689     .input_size(13, 14)
5690     .padding(2)
5691     .kernel_size(3, 3)
5692     .dilation(2)
5693     .group_input_channels(27)
5694     .group_output_channels(19)
5695     .iterations(3)
5696     .use_jit(true)
5697     .TestNHWCxF32();
5698 }
5699 
TEST(CONVOLUTION_NHWC_F32,jit_3x3d1x2)5700 TEST(CONVOLUTION_NHWC_F32, jit_3x3d1x2) {
5701   ConvolutionOperatorTester()
5702     .input_size(14, 15)
5703     .padding(1, 2)
5704     .kernel_size(3, 3)
5705     .dilation(1, 2)
5706     .group_input_channels(27)
5707     .group_output_channels(19)
5708     .iterations(3)
5709     .use_jit(true)
5710     .TestNHWCxF32();
5711 }
5712 
TEST(CONVOLUTION_NHWC_F32,jit_3x3d2x1)5713 TEST(CONVOLUTION_NHWC_F32, jit_3x3d2x1) {
5714   ConvolutionOperatorTester()
5715     .input_size(15, 14)
5716     .padding(2, 1)
5717     .kernel_size(3, 3)
5718     .dilation(2, 1)
5719     .group_input_channels(27)
5720     .group_output_channels(19)
5721     .iterations(3)
5722     .use_jit(true)
5723     .TestNHWCxF32();
5724 }
5725 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_3x3)5726 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_3x3) {
5727   ConvolutionOperatorTester()
5728     .input_size(3, 3)
5729     .padding(1)
5730     .kernel_size(3, 3)
5731     .group_input_channels(23)
5732     .group_output_channels(19)
5733     .iterations(3)
5734     .use_jit(true)
5735     .TestNHWCxF32();
5736 }
5737 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_3x3_with_qmin)5738 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_3x3_with_qmin) {
5739   ConvolutionOperatorTester()
5740     .input_size(3, 3)
5741     .padding(1)
5742     .kernel_size(3, 3)
5743     .group_input_channels(23)
5744     .group_output_channels(19)
5745     .qmin(128)
5746     .iterations(3)
5747     .use_jit(true)
5748     .TestNHWCxF32();
5749 }
5750 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_3x3_with_qmax)5751 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_3x3_with_qmax) {
5752   ConvolutionOperatorTester()
5753     .input_size(3, 3)
5754     .padding(1)
5755     .kernel_size(3, 3)
5756     .group_input_channels(23)
5757     .group_output_channels(19)
5758     .qmax(128)
5759     .iterations(3)
5760     .use_jit(true)
5761     .TestNHWCxF32();
5762 }
5763 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_3x3_with_input_stride)5764 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_3x3_with_input_stride) {
5765   ConvolutionOperatorTester()
5766     .input_size(3, 3)
5767     .padding(1)
5768     .kernel_size(3, 3)
5769     .input_channel_stride(28)
5770     .group_input_channels(23)
5771     .group_output_channels(19)
5772     .iterations(3)
5773     .use_jit(true)
5774     .TestNHWCxF32();
5775 }
5776 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_3x3_with_output_stride)5777 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_3x3_with_output_stride) {
5778   ConvolutionOperatorTester()
5779     .input_size(3, 3)
5780     .padding(1)
5781     .kernel_size(3, 3)
5782     .output_channel_stride(29)
5783     .group_input_channels(23)
5784     .group_output_channels(19)
5785     .iterations(3)
5786     .use_jit(true)
5787     .TestNHWCxF32();
5788 }
5789 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_3x3)5790 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_3x3) {
5791   ConvolutionOperatorTester()
5792     .input_size(3, 3)
5793     .padding(1)
5794     .kernel_size(3, 3)
5795     .groups(2)
5796     .group_input_channels(17)
5797     .group_output_channels(13)
5798     .iterations(3)
5799     .use_jit(true)
5800     .TestNHWCxF32();
5801 }
5802 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_3x3_with_qmin)5803 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_3x3_with_qmin) {
5804   ConvolutionOperatorTester()
5805     .input_size(3, 3)
5806     .padding(1)
5807     .kernel_size(3, 3)
5808     .groups(2)
5809     .group_input_channels(17)
5810     .group_output_channels(13)
5811     .qmin(128)
5812     .iterations(3)
5813     .use_jit(true)
5814     .TestNHWCxF32();
5815 }
5816 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_3x3_with_qmax)5817 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_3x3_with_qmax) {
5818   ConvolutionOperatorTester()
5819     .input_size(3, 3)
5820     .padding(1)
5821     .kernel_size(3, 3)
5822     .groups(2)
5823     .group_input_channels(17)
5824     .group_output_channels(13)
5825     .qmax(128)
5826     .iterations(3)
5827     .use_jit(true)
5828     .TestNHWCxF32();
5829 }
5830 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_3x3_with_input_stride)5831 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_3x3_with_input_stride) {
5832   ConvolutionOperatorTester()
5833     .input_size(3, 3)
5834     .padding(1)
5835     .kernel_size(3, 3)
5836     .groups(2)
5837     .input_channel_stride(37)
5838     .group_input_channels(17)
5839     .group_output_channels(13)
5840     .iterations(3)
5841     .use_jit(true)
5842     .TestNHWCxF32();
5843 }
5844 
TEST(CONVOLUTION_NHWC_F32,jit_unioutput_grouped_3x3_with_output_stride)5845 TEST(CONVOLUTION_NHWC_F32, jit_unioutput_grouped_3x3_with_output_stride) {
5846   ConvolutionOperatorTester()
5847     .input_size(3, 3)
5848     .padding(1)
5849     .kernel_size(3, 3)
5850     .groups(2)
5851     .output_channel_stride(41)
5852     .group_input_channels(17)
5853     .group_output_channels(13)
5854     .iterations(3)
5855     .use_jit(true)
5856     .TestNHWCxF32();
5857 }
5858 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_1x1)5859 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_1x1) {
5860   ConvolutionOperatorTester()
5861     .input_size(15, 14)
5862     .kernel_size(1, 1)
5863     .groups(24)
5864     .iterations(3)
5865     .use_jit(true)
5866     .TestNHWCxF32();
5867 }
5868 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_1x1_without_bias)5869 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_1x1_without_bias) {
5870   ConvolutionOperatorTester()
5871     .has_bias(false)
5872     .input_size(15, 14)
5873     .kernel_size(1, 1)
5874     .groups(24)
5875     .iterations(3)
5876     .use_jit(true)
5877     .TestNHWCxF32();
5878 }
5879 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2)5880 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2) {
5881   ConvolutionOperatorTester()
5882     .input_size(15, 14)
5883     .padding(1, 1)
5884     .kernel_size(2, 2)
5885     .groups(24)
5886     .iterations(3)
5887     .use_jit(true)
5888     .TestNHWCxF32();
5889 }
5890 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2_without_bias)5891 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2_without_bias) {
5892   ConvolutionOperatorTester()
5893     .has_bias(false)
5894     .input_size(15, 14)
5895     .padding(1, 1)
5896     .kernel_size(2, 2)
5897     .groups(24)
5898     .iterations(3)
5899     .use_jit(true)
5900     .TestNHWCxF32();
5901 }
5902 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2s2)5903 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2s2) {
5904   ConvolutionOperatorTester()
5905     .input_size(15, 14)
5906     .padding(1, 1)
5907     .kernel_size(2, 2)
5908     .subsampling(2)
5909     .groups(27)
5910     .iterations(3)
5911     .use_jit(true)
5912     .TestNHWCxF32();
5913 }
5914 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2s1x2)5915 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2s1x2) {
5916   ConvolutionOperatorTester()
5917     .input_size(15, 14)
5918     .padding(1, 1)
5919     .kernel_size(2, 2)
5920     .subsampling(1, 2)
5921     .groups(27)
5922     .iterations(3)
5923     .use_jit(true)
5924     .TestNHWCxF32();
5925 }
5926 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2s2x1)5927 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2s2x1) {
5928   ConvolutionOperatorTester()
5929     .input_size(15, 14)
5930     .padding(1, 1)
5931     .kernel_size(2, 2)
5932     .subsampling(2, 1)
5933     .groups(27)
5934     .iterations(3)
5935     .use_jit(true)
5936     .TestNHWCxF32();
5937 }
5938 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2d2)5939 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2d2) {
5940   ConvolutionOperatorTester()
5941     .input_size(15, 14)
5942     .padding(1, 1)
5943     .kernel_size(2, 2)
5944     .dilation(2)
5945     .groups(27)
5946     .iterations(3)
5947     .use_jit(true)
5948     .TestNHWCxF32();
5949 }
5950 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2d1x2)5951 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2d1x2) {
5952   ConvolutionOperatorTester()
5953     .input_size(15, 14)
5954     .padding(1, 1)
5955     .kernel_size(2, 2)
5956     .dilation(1, 2)
5957     .groups(27)
5958     .iterations(3)
5959     .use_jit(true)
5960     .TestNHWCxF32();
5961 }
5962 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_2x2d2x1)5963 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_2x2d2x1) {
5964   ConvolutionOperatorTester()
5965     .input_size(15, 14)
5966     .padding(1, 1)
5967     .kernel_size(2, 2)
5968     .dilation(2, 1)
5969     .groups(27)
5970     .iterations(3)
5971     .use_jit(true)
5972     .TestNHWCxF32();
5973 }
5974 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3)5975 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3) {
5976   ConvolutionOperatorTester()
5977     .input_size(15, 14)
5978     .padding(1, 1)
5979     .kernel_size(3, 3)
5980     .groups(24)
5981     .iterations(3)
5982     .use_jit(true)
5983     .TestNHWCxF32();
5984 }
5985 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3_without_bias)5986 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3_without_bias) {
5987   ConvolutionOperatorTester()
5988     .has_bias(false)
5989     .input_size(15, 14)
5990     .padding(1, 1)
5991     .kernel_size(3, 3)
5992     .groups(24)
5993     .iterations(3)
5994     .use_jit(true)
5995     .TestNHWCxF32();
5996 }
5997 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3s2)5998 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3s2) {
5999   ConvolutionOperatorTester()
6000     .input_size(15, 14)
6001     .padding(1, 1)
6002     .kernel_size(3, 3)
6003     .subsampling(2)
6004     .groups(27)
6005     .iterations(3)
6006     .use_jit(true)
6007     .TestNHWCxF32();
6008 }
6009 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3s2_with_tf_same_padding)6010 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3s2_with_tf_same_padding) {
6011   for (size_t input_height = 14; input_height <= 15; input_height++) {
6012     for (size_t input_width = 14; input_width <= 15; input_width++) {
6013       ConvolutionOperatorTester()
6014         .input_size(input_height, input_width)
6015         .padding_tf_same(true)
6016         .kernel_size(3, 3)
6017         .subsampling(2)
6018         .groups(27)
6019         .iterations(3)
6020         .use_jit(true)
6021         .TestNHWCxF32();
6022     }
6023   }
6024 }
6025 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3s1x2)6026 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3s1x2) {
6027   ConvolutionOperatorTester()
6028     .input_size(15, 14)
6029     .padding(1, 1)
6030     .kernel_size(3, 3)
6031     .subsampling(1, 2)
6032     .groups(27)
6033     .iterations(3)
6034     .use_jit(true)
6035     .TestNHWCxF32();
6036 }
6037 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3s1x2_with_tf_same_padding)6038 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3s1x2_with_tf_same_padding) {
6039   for (size_t input_height = 14; input_height <= 15; input_height++) {
6040     for (size_t input_width = 14; input_width <= 15; input_width++) {
6041       ConvolutionOperatorTester()
6042         .input_size(input_height, input_width)
6043         .padding_tf_same(true)
6044         .kernel_size(3, 3)
6045         .subsampling(1, 2)
6046         .groups(27)
6047         .iterations(3)
6048         .use_jit(true)
6049         .TestNHWCxF32();
6050     }
6051   }
6052 }
6053 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3s2x1)6054 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3s2x1) {
6055   ConvolutionOperatorTester()
6056     .input_size(15, 14)
6057     .padding(1, 1)
6058     .kernel_size(3, 3)
6059     .subsampling(2, 1)
6060     .groups(27)
6061     .iterations(3)
6062     .use_jit(true)
6063     .TestNHWCxF32();
6064 }
6065 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3s2x1_with_tf_same_padding)6066 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3s2x1_with_tf_same_padding) {
6067   for (size_t input_height = 14; input_height <= 15; input_height++) {
6068     for (size_t input_width = 14; input_width <= 15; input_width++) {
6069       ConvolutionOperatorTester()
6070         .input_size(input_height, input_width)
6071         .padding_tf_same(true)
6072         .kernel_size(3, 3)
6073         .subsampling(2, 1)
6074         .groups(27)
6075         .iterations(3)
6076         .use_jit(true)
6077         .TestNHWCxF32();
6078     }
6079   }
6080 }
6081 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3d2)6082 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3d2) {
6083   ConvolutionOperatorTester()
6084     .input_size(15, 14)
6085     .padding(1, 1)
6086     .kernel_size(3, 3)
6087     .dilation(2)
6088     .groups(27)
6089     .iterations(3)
6090     .use_jit(true)
6091     .TestNHWCxF32();
6092 }
6093 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3d1x2)6094 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3d1x2) {
6095   ConvolutionOperatorTester()
6096     .input_size(15, 14)
6097     .padding(1, 1)
6098     .kernel_size(3, 3)
6099     .dilation(1, 2)
6100     .groups(27)
6101     .iterations(3)
6102     .use_jit(true)
6103     .TestNHWCxF32();
6104 }
6105 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_3x3d2x1)6106 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_3x3d2x1) {
6107   ConvolutionOperatorTester()
6108     .input_size(15, 14)
6109     .padding(1, 1)
6110     .kernel_size(3, 3)
6111     .dilation(2, 1)
6112     .groups(27)
6113     .iterations(3)
6114     .use_jit(true)
6115     .TestNHWCxF32();
6116 }
6117 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5)6118 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5) {
6119   ConvolutionOperatorTester()
6120     .input_size(15, 14)
6121     .padding(2, 2)
6122     .kernel_size(5, 5)
6123     .groups(27)
6124     .iterations(3)
6125     .use_jit(true)
6126     .TestNHWCxF32();
6127 }
6128 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5_without_bias)6129 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5_without_bias) {
6130   ConvolutionOperatorTester()
6131     .has_bias(false)
6132     .input_size(15, 14)
6133     .padding(2, 2)
6134     .kernel_size(5, 5)
6135     .groups(27)
6136     .iterations(3)
6137     .use_jit(true)
6138     .TestNHWCxF32();
6139 }
6140 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5s2)6141 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5s2) {
6142   ConvolutionOperatorTester()
6143     .input_size(15, 14)
6144     .padding(2, 2)
6145     .kernel_size(5, 5)
6146     .subsampling(2)
6147     .groups(27)
6148     .iterations(3)
6149     .use_jit(true)
6150     .TestNHWCxF32();
6151 }
6152 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5s1x2)6153 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5s1x2) {
6154   ConvolutionOperatorTester()
6155     .input_size(15, 14)
6156     .padding(2, 2)
6157     .kernel_size(5, 5)
6158     .subsampling(1, 2)
6159     .groups(27)
6160     .iterations(3)
6161     .use_jit(true)
6162     .TestNHWCxF32();
6163 }
6164 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5s2x1)6165 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5s2x1) {
6166   ConvolutionOperatorTester()
6167     .input_size(15, 14)
6168     .padding(2, 2)
6169     .kernel_size(5, 5)
6170     .subsampling(2, 1)
6171     .groups(27)
6172     .iterations(3)
6173     .use_jit(true)
6174     .TestNHWCxF32();
6175 }
6176 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5d2)6177 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5d2) {
6178   ConvolutionOperatorTester()
6179     .input_size(15, 14)
6180     .padding(2, 2)
6181     .kernel_size(5, 5)
6182     .dilation(2)
6183     .groups(27)
6184     .iterations(3)
6185     .use_jit(true)
6186     .TestNHWCxF32();
6187 }
6188 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5d1x2)6189 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5d1x2) {
6190   ConvolutionOperatorTester()
6191     .input_size(15, 14)
6192     .padding(2, 2)
6193     .kernel_size(5, 5)
6194     .dilation(1, 2)
6195     .groups(27)
6196     .iterations(3)
6197     .use_jit(true)
6198     .TestNHWCxF32();
6199 }
6200 
TEST(CONVOLUTION_NHWC_F32,DISABLED_jit_depthwise_5x5d2x1)6201 TEST(CONVOLUTION_NHWC_F32, DISABLED_jit_depthwise_5x5d2x1) {
6202   ConvolutionOperatorTester()
6203     .input_size(15, 14)
6204     .padding(2, 2)
6205     .kernel_size(5, 5)
6206     .dilation(2, 1)
6207     .groups(27)
6208     .iterations(3)
6209     .use_jit(true)
6210     .TestNHWCxF32();
6211 }
6212 
6213 // Test interaction of JIT with weights cache.
TEST(CONVOLUTION_NHWC_F32,jit_weights_cache_1x1)6214 TEST(CONVOLUTION_NHWC_F32, jit_weights_cache_1x1) {
6215   ConvolutionOperatorTester()
6216     .input_size(27, 29)
6217     .kernel_size(1, 1)
6218     .group_input_channels(23)
6219     .group_output_channels(19)
6220     .iterations(3)
6221     .use_jit(true)
6222     .use_weights_cache(true)
6223     .TestNHWCxF32();
6224 }
6225 #endif  // XNN_PLATFORM_JIT && XNN_ENABLE_JIT
6226 
6227 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 1x1) {
6228   ConvolutionOperatorTester()
6229     .depthwise_layout(true)
6230     .input_size(15, 14)
6231     .kernel_size(1, 1)
6232     .groups(24)
6233     .iterations(3)
6234     .TestNHWCxF32();
6235 }
6236 
6237 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 1x1_with_depth_multiplier) {
6238   ConvolutionOperatorTester()
6239     .depthwise_layout(true)
6240     .input_size(15, 14)
6241     .kernel_size(1, 1)
6242     .groups(24)
6243     .group_output_channels(3)
6244     .iterations(3)
6245     .TestNHWCxF32();
6246 }
6247 
6248 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 1x1_without_bias) {
6249   ConvolutionOperatorTester()
6250     .depthwise_layout(true)
6251     .has_bias(false)
6252     .input_size(15, 14)
6253     .kernel_size(1, 1)
6254     .groups(24)
6255     .iterations(3)
6256     .TestNHWCxF32();
6257 }
6258 
6259 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 2x2) {
6260   ConvolutionOperatorTester()
6261     .depthwise_layout(true)
6262     .input_size(15, 14)
6263     .padding(1, 1)
6264     .kernel_size(2, 2)
6265     .groups(24)
6266     .iterations(3)
6267     .TestNHWCxF32();
6268 }
6269 
6270 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 2x2_with_depth_multiplier) {
6271   ConvolutionOperatorTester()
6272     .depthwise_layout(true)
6273     .input_size(15, 14)
6274     .padding(1, 1)
6275     .kernel_size(2, 2)
6276     .groups(24)
6277     .group_output_channels(3)
6278     .iterations(3)
6279     .TestNHWCxF32();
6280 }
6281 
6282 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 2x2_without_bias) {
6283   ConvolutionOperatorTester()
6284     .depthwise_layout(true)
6285     .has_bias(false)
6286     .input_size(15, 14)
6287     .padding(1, 1)
6288     .kernel_size(2, 2)
6289     .groups(24)
6290     .iterations(3)
6291     .TestNHWCxF32();
6292 }
6293 
6294 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 3x3) {
6295   ConvolutionOperatorTester()
6296     .depthwise_layout(true)
6297     .input_size(15, 14)
6298     .padding(1, 1)
6299     .kernel_size(3, 3)
6300     .groups(24)
6301     .iterations(3)
6302     .TestNHWCxF32();
6303 }
6304 
6305 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 3x3_with_depth_multiplier) {
6306   ConvolutionOperatorTester()
6307     .depthwise_layout(true)
6308     .input_size(15, 14)
6309     .padding(1, 1)
6310     .kernel_size(3, 3)
6311     .groups(24)
6312     .group_output_channels(3)
6313     .iterations(3)
6314     .TestNHWCxF32();
6315 }
6316 
6317 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 3x3_without_bias) {
6318   ConvolutionOperatorTester()
6319     .depthwise_layout(true)
6320     .has_bias(false)
6321     .input_size(15, 14)
6322     .padding(1, 1)
6323     .kernel_size(3, 3)
6324     .groups(24)
6325     .iterations(3)
6326     .TestNHWCxF32();
6327 }
6328 
6329 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 3x3s2_with_tf_same_padding) {
6330   for (size_t input_height = 14; input_height <= 15; input_height++) {
6331     for (size_t input_width = 14; input_width <= 15; input_width++) {
6332       ConvolutionOperatorTester()
6333         .depthwise_layout(true)
6334         .input_size(input_height, input_width)
6335         .padding_tf_same(true)
6336         .kernel_size(3, 3)
6337         .groups(24)
6338         .iterations(3)
6339         .TestNHWCxF32();
6340     }
6341   }
6342 }
6343 
6344 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 5x5) {
6345   ConvolutionOperatorTester()
6346     .depthwise_layout(true)
6347     .input_size(15, 14)
6348     .padding(2, 2)
6349     .kernel_size(5, 5)
6350     .groups(24)
6351     .iterations(3)
6352     .TestNHWCxF32();
6353 }
6354 
6355 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 5x5_with_depth_multiplier) {
6356   ConvolutionOperatorTester()
6357     .depthwise_layout(true)
6358     .input_size(15, 14)
6359     .padding(2, 2)
6360     .kernel_size(5, 5)
6361     .groups(24)
6362     .group_output_channels(3)
6363     .iterations(3)
6364     .TestNHWCxF32();
6365 }
6366 
6367 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 5x5_without_bias) {
6368   ConvolutionOperatorTester()
6369     .depthwise_layout(true)
6370     .has_bias(false)
6371     .input_size(15, 14)
6372     .padding(2, 2)
6373     .kernel_size(5, 5)
6374     .groups(24)
6375     .iterations(3)
6376     .TestNHWCxF32();
6377 }
6378 
6379 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 7x7) {
6380   ConvolutionOperatorTester()
6381     .depthwise_layout(true)
6382     .input_size(15, 14)
6383     .padding(3, 3)
6384     .kernel_size(7, 7)
6385     .groups(24)
6386     .iterations(3)
6387     .TestNHWCxF32();
6388 }
6389 
6390 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, 7x7_without_bias) {
6391   ConvolutionOperatorTester()
6392     .depthwise_layout(true)
6393     .has_bias(false)
6394     .input_size(15, 14)
6395     .padding(3, 3)
6396     .kernel_size(7, 7)
6397     .groups(24)
6398     .iterations(3)
6399     .TestNHWCxF32();
6400 }
6401 
6402 // Tests dwconv microkernel with weights cache.
TEST(DEPTHWISE_CONVOLUTION_NHWC_F32,weights_cache_1x1)6403 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, weights_cache_1x1) {
6404   ConvolutionOperatorTester()
6405     .depthwise_layout(true)
6406     .input_size(15, 14)
6407     .kernel_size(1, 1)
6408     .groups(24)
6409     .use_weights_cache(true)
6410     .iterations(3)
6411     .TestNHWCxF32();
6412 }
6413 
6414 // Tests dwconv microkernek with non 1x1 kernel (dwconv_hwg packing).
TEST(DEPTHWISE_CONVOLUTION_NHWC_F32,weights_cache_2x2)6415 TEST(DEPTHWISE_CONVOLUTION_NHWC_F32, weights_cache_2x2) {
6416   ConvolutionOperatorTester()
6417     .depthwise_layout(true)
6418     .input_size(15, 14)
6419     .padding(1, 1)
6420     .kernel_size(2, 2)
6421     .groups(24)
6422     .use_weights_cache(true)
6423     .iterations(3)
6424     .TestNHWCxF32();
6425 }
6426 
TEST(CONVOLUTION_NHWC_F32,setup_changing_input_buffer)6427 TEST(CONVOLUTION_NHWC_F32, setup_changing_input_buffer) {
6428   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6429   ConvolutionOperatorTester()
6430     .batch_size(3)
6431     .input_height(8)
6432     .input_width(8)
6433     .kernel_height(5)
6434     .kernel_width(3)
6435     .group_input_channels(15)
6436     .group_output_channels(17)
6437     .TestSetupNHWCxF32();
6438 }
6439 
TEST(CONVOLUTION_NHWC_F32,setup_changing_input_buffer_grouped)6440 TEST(CONVOLUTION_NHWC_F32, setup_changing_input_buffer_grouped) {
6441   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6442   ConvolutionOperatorTester()
6443     .batch_size(3)
6444     .input_height(8)
6445     .input_width(8)
6446     .kernel_height(5)
6447     .kernel_width(3)
6448     .groups(2)
6449     .group_input_channels(15)
6450     .group_output_channels(17)
6451     .TestSetupNHWCxF32();
6452 }
6453 
TEST(CONVOLUTION_NHWC_F32,setup_changing_input_buffer_depthwise)6454 TEST(CONVOLUTION_NHWC_F32, setup_changing_input_buffer_depthwise) {
6455   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6456   ConvolutionOperatorTester()
6457     .batch_size(3)
6458     .input_height(8)
6459     .input_width(8)
6460     .kernel_height(3)
6461     .kernel_width(3)
6462     .groups(19)
6463     .group_input_channels(1)
6464     .group_output_channels(1)
6465     .TestSetupNHWCxF32();
6466 }
6467 
TEST(CONVOLUTION_NHWC_F32,setup_increasing_batch)6468 TEST(CONVOLUTION_NHWC_F32, setup_increasing_batch) {
6469   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6470   ConvolutionOperatorTester()
6471     .batch_size(3)
6472     .next_batch_size(5)
6473     .input_height(8)
6474     .input_width(8)
6475     .kernel_height(5)
6476     .kernel_width(3)
6477     .group_input_channels(15)
6478     .group_output_channels(17)
6479     .TestSetupNHWCxF32();
6480 }
6481 
TEST(CONVOLUTION_NHWC_F32,setup_increasing_batch_grouped)6482 TEST(CONVOLUTION_NHWC_F32, setup_increasing_batch_grouped) {
6483   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6484   ConvolutionOperatorTester()
6485     .batch_size(3)
6486     .next_batch_size(5)
6487     .input_height(8)
6488     .input_width(8)
6489     .kernel_height(5)
6490     .kernel_width(3)
6491     .groups(2)
6492     .group_input_channels(15)
6493     .group_output_channels(17)
6494     .TestSetupNHWCxF32();
6495 }
6496 
TEST(CONVOLUTION_NHWC_F32,setup_increasing_batch_depthwise)6497 TEST(CONVOLUTION_NHWC_F32, setup_increasing_batch_depthwise) {
6498   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6499   ConvolutionOperatorTester()
6500     .batch_size(3)
6501     .next_batch_size(5)
6502     .input_height(8)
6503     .input_width(8)
6504     .kernel_height(3)
6505     .kernel_width(3)
6506     .groups(19)
6507     .group_input_channels(1)
6508     .group_output_channels(1)
6509     .TestSetupNHWCxF32();
6510 }
6511 
TEST(CONVOLUTION_NHWC_F32,setup_decreasing_batch)6512 TEST(CONVOLUTION_NHWC_F32, setup_decreasing_batch) {
6513   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6514   ConvolutionOperatorTester()
6515     .batch_size(5)
6516     .next_batch_size(3)
6517     .input_height(8)
6518     .input_width(8)
6519     .kernel_height(5)
6520     .kernel_width(3)
6521     .group_input_channels(15)
6522     .group_output_channels(17)
6523     .TestSetupNHWCxF32();
6524 }
6525 
TEST(CONVOLUTION_NHWC_F32,setup_decreasing_batch_grouped)6526 TEST(CONVOLUTION_NHWC_F32, setup_decreasing_batch_grouped) {
6527   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6528   ConvolutionOperatorTester()
6529     .batch_size(5)
6530     .next_batch_size(3)
6531     .input_height(8)
6532     .input_width(8)
6533     .kernel_height(5)
6534     .kernel_width(3)
6535     .groups(2)
6536     .group_input_channels(15)
6537     .group_output_channels(17)
6538     .TestSetupNHWCxF32();
6539 }
6540 
TEST(CONVOLUTION_NHWC_F32,setup_decreasing_batch_depthwise)6541 TEST(CONVOLUTION_NHWC_F32, setup_decreasing_batch_depthwise) {
6542   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6543   ConvolutionOperatorTester()
6544     .batch_size(5)
6545     .next_batch_size(3)
6546     .input_height(8)
6547     .input_width(8)
6548     .kernel_height(3)
6549     .kernel_width(3)
6550     .groups(19)
6551     .group_input_channels(1)
6552     .group_output_channels(1)
6553     .TestSetupNHWCxF32();
6554 }
6555 
TEST(CONVOLUTION_NHWC_F32,setup_changing_height)6556 TEST(CONVOLUTION_NHWC_F32, setup_changing_height) {
6557   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6558   ConvolutionOperatorTester()
6559     .batch_size(3)
6560     .input_height(8)
6561     .input_width(8)
6562     .next_input_height(9)
6563     .kernel_height(5)
6564     .kernel_width(3)
6565     .group_input_channels(15)
6566     .group_output_channels(17)
6567     .TestSetupNHWCxF32();
6568   ConvolutionOperatorTester()
6569     .batch_size(3)
6570     .input_height(8)
6571     .input_width(8)
6572     .next_input_height(7)
6573     .kernel_height(5)
6574     .kernel_width(3)
6575     .group_input_channels(15)
6576     .group_output_channels(17)
6577     .TestSetupNHWCxF32();
6578 }
6579 
TEST(CONVOLUTION_NHWC_F32,setup_changing_height_grouped)6580 TEST(CONVOLUTION_NHWC_F32, setup_changing_height_grouped) {
6581   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6582   ConvolutionOperatorTester()
6583     .batch_size(3)
6584     .input_height(8)
6585     .input_width(8)
6586     .next_input_height(9)
6587     .kernel_height(5)
6588     .kernel_width(3)
6589     .groups(2)
6590     .group_input_channels(15)
6591     .group_output_channels(17)
6592     .TestSetupNHWCxF32();
6593   ConvolutionOperatorTester()
6594     .batch_size(3)
6595     .input_height(8)
6596     .input_width(8)
6597     .next_input_height(7)
6598     .kernel_height(5)
6599     .kernel_width(3)
6600     .groups(2)
6601     .group_input_channels(15)
6602     .group_output_channels(17)
6603     .TestSetupNHWCxF32();
6604 }
6605 
TEST(CONVOLUTION_NHWC_F32,setup_changing_height_depthwise)6606 TEST(CONVOLUTION_NHWC_F32, setup_changing_height_depthwise) {
6607   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6608   ConvolutionOperatorTester()
6609     .batch_size(3)
6610     .input_height(8)
6611     .input_width(8)
6612     .next_input_height(9)
6613     .kernel_height(3)
6614     .kernel_width(3)
6615     .groups(19)
6616     .group_input_channels(1)
6617     .group_output_channels(1)
6618     .TestSetupNHWCxF32();
6619   ConvolutionOperatorTester()
6620     .batch_size(3)
6621     .input_height(8)
6622     .input_width(8)
6623     .next_input_height(7)
6624     .kernel_height(3)
6625     .kernel_width(3)
6626     .groups(19)
6627     .group_input_channels(1)
6628     .group_output_channels(1)
6629     .TestSetupNHWCxF32();
6630 }
6631 
TEST(CONVOLUTION_NHWC_F32,setup_changing_width)6632 TEST(CONVOLUTION_NHWC_F32, setup_changing_width) {
6633   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6634   ConvolutionOperatorTester()
6635     .batch_size(3)
6636     .input_height(8)
6637     .input_width(8)
6638     .next_input_width(9)
6639     .kernel_height(5)
6640     .kernel_width(3)
6641     .group_input_channels(15)
6642     .group_output_channels(17)
6643     .TestSetupNHWCxF32();
6644   ConvolutionOperatorTester()
6645     .batch_size(3)
6646     .input_height(8)
6647     .input_width(8)
6648     .next_input_width(7)
6649     .kernel_height(5)
6650     .kernel_width(3)
6651     .group_input_channels(15)
6652     .group_output_channels(17)
6653     .TestSetupNHWCxF32();
6654 }
6655 
TEST(CONVOLUTION_NHWC_F32,setup_changing_width_grouped)6656 TEST(CONVOLUTION_NHWC_F32, setup_changing_width_grouped) {
6657   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6658   ConvolutionOperatorTester()
6659     .batch_size(3)
6660     .input_height(8)
6661     .input_width(8)
6662     .next_input_width(9)
6663     .kernel_height(5)
6664     .kernel_width(3)
6665     .groups(2)
6666     .group_input_channels(15)
6667     .group_output_channels(17)
6668     .TestSetupNHWCxF32();
6669   ConvolutionOperatorTester()
6670     .batch_size(3)
6671     .input_height(8)
6672     .input_width(8)
6673     .next_input_width(7)
6674     .kernel_height(5)
6675     .kernel_width(3)
6676     .groups(2)
6677     .group_input_channels(15)
6678     .group_output_channels(17)
6679     .TestSetupNHWCxF32();
6680 }
6681 
TEST(CONVOLUTION_NHWC_F32,setup_changing_width_depthwise)6682 TEST(CONVOLUTION_NHWC_F32, setup_changing_width_depthwise) {
6683   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6684   ConvolutionOperatorTester()
6685     .batch_size(3)
6686     .input_height(8)
6687     .input_width(8)
6688     .next_input_width(9)
6689     .kernel_height(3)
6690     .kernel_width(3)
6691     .groups(19)
6692     .group_input_channels(1)
6693     .group_output_channels(1)
6694     .TestSetupNHWCxF32();
6695   ConvolutionOperatorTester()
6696     .batch_size(3)
6697     .input_height(8)
6698     .input_width(8)
6699     .next_input_width(7)
6700     .kernel_height(3)
6701     .kernel_width(3)
6702     .groups(19)
6703     .group_input_channels(1)
6704     .group_output_channels(1)
6705     .TestSetupNHWCxF32();
6706 }
6707 
TEST(CONVOLUTION_NHWC_F32,setup_swap_height_and_width)6708 TEST(CONVOLUTION_NHWC_F32, setup_swap_height_and_width) {
6709   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6710   ConvolutionOperatorTester()
6711     .batch_size(3)
6712     .input_height(9)
6713     .input_width(8)
6714     .next_input_height(8)
6715     .next_input_width(9)
6716     .kernel_height(5)
6717     .kernel_width(3)
6718     .group_input_channels(15)
6719     .group_output_channels(17)
6720     .TestSetupNHWCxF32();
6721 }
6722 
TEST(CONVOLUTION_NHWC_F32,setup_swap_height_and_width_grouped)6723 TEST(CONVOLUTION_NHWC_F32, setup_swap_height_and_width_grouped) {
6724   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6725   ConvolutionOperatorTester()
6726     .batch_size(3)
6727     .input_height(9)
6728     .input_width(8)
6729     .next_input_height(8)
6730     .next_input_width(9)
6731     .kernel_height(5)
6732     .kernel_width(3)
6733     .groups(2)
6734     .group_input_channels(15)
6735     .group_output_channels(17)
6736     .TestSetupNHWCxF32();
6737 }
6738 
TEST(CONVOLUTION_NHWC_F32,setup_swap_height_and_width_depthwise)6739 TEST(CONVOLUTION_NHWC_F32, setup_swap_height_and_width_depthwise) {
6740   ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
6741   ConvolutionOperatorTester()
6742     .batch_size(3)
6743     .input_height(9)
6744     .input_width(8)
6745     .next_input_height(8)
6746     .next_input_width(9)
6747     .kernel_height(3)
6748     .kernel_width(3)
6749     .groups(19)
6750     .group_input_channels(1)
6751     .group_output_channels(1)
6752     .TestSetupNHWCxF32();
6753 }
6754 
6755 TEST(CONVOLUTION_NHWC_F16, 1x1) {
6756   ConvolutionOperatorTester()
6757     .input_size(27, 29)
6758     .kernel_size(1, 1)
6759     .group_input_channels(23)
6760     .group_output_channels(19)
6761     .iterations(3)
6762     .TestNHWCxF16();
6763 }
6764 
6765 TEST(CONVOLUTION_NHWC_F16, 1x1_with_fp32_weights) {
6766   ConvolutionOperatorTester()
6767     .input_size(27, 29)
6768     .kernel_size(1, 1)
6769     .group_input_channels(23)
6770     .group_output_channels(19)
6771     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
6772     .iterations(3)
6773     .TestNHWCxF16();
6774 }
6775 
6776 TEST(CONVOLUTION_NHWC_F16, 1x1_with_qmin) {
6777   ConvolutionOperatorTester()
6778     .input_size(27, 29)
6779     .kernel_size(1, 1)
6780     .group_input_channels(23)
6781     .group_output_channels(19)
6782     .qmin(128)
6783     .iterations(3)
6784     .TestNHWCxF16();
6785 }
6786 
6787 TEST(CONVOLUTION_NHWC_F16, 1x1_with_qmax) {
6788   ConvolutionOperatorTester()
6789     .input_size(27, 29)
6790     .kernel_size(1, 1)
6791     .group_input_channels(23)
6792     .group_output_channels(19)
6793     .qmax(128)
6794     .iterations(3)
6795     .TestNHWCxF16();
6796 }
6797 
6798 TEST(CONVOLUTION_NHWC_F16, 1x1_with_input_stride) {
6799   ConvolutionOperatorTester()
6800     .input_size(27, 29)
6801     .kernel_size(1, 1)
6802     .input_channel_stride(28)
6803     .group_input_channels(23)
6804     .group_output_channels(19)
6805     .iterations(3)
6806     .TestNHWCxF16();
6807 }
6808 
6809 TEST(CONVOLUTION_NHWC_F16, 1x1_with_output_stride) {
6810   ConvolutionOperatorTester()
6811     .input_size(27, 29)
6812     .kernel_size(1, 1)
6813     .output_channel_stride(29)
6814     .group_input_channels(23)
6815     .group_output_channels(19)
6816     .iterations(3)
6817     .TestNHWCxF16();
6818 }
6819 
6820 TEST(CONVOLUTION_NHWC_F16, 1x1_without_bias) {
6821   ConvolutionOperatorTester()
6822     .has_bias(false)
6823     .input_size(13, 14)
6824     .kernel_size(1, 1)
6825     .group_input_channels(23)
6826     .group_output_channels(19)
6827     .iterations(3)
6828     .TestNHWCxF16();
6829 }
6830 
6831 TEST(CONVOLUTION_NHWC_F16, 1x1_with_batch) {
6832   ConvolutionOperatorTester()
6833     .batch_size(3)
6834     .input_size(13, 14)
6835     .kernel_size(1, 1)
6836     .group_input_channels(23)
6837     .group_output_channels(19)
6838     .iterations(3)
6839     .TestNHWCxF16();
6840 }
6841 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1)6842 TEST(CONVOLUTION_NHWC_F16, grouped_1x1) {
6843   ConvolutionOperatorTester()
6844     .input_size(24, 25)
6845     .kernel_size(1, 1)
6846     .groups(2)
6847     .group_input_channels(17)
6848     .group_output_channels(19)
6849     .iterations(3)
6850     .TestNHWCxF16();
6851 }
6852 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_with_fp32_weights)6853 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_with_fp32_weights) {
6854   ConvolutionOperatorTester()
6855     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
6856     .input_size(24, 25)
6857     .kernel_size(1, 1)
6858     .groups(2)
6859     .group_input_channels(17)
6860     .group_output_channels(19)
6861     .iterations(3)
6862     .TestNHWCxF16();
6863 }
6864 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_with_qmin)6865 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_with_qmin) {
6866   ConvolutionOperatorTester()
6867     .input_size(24, 25)
6868     .kernel_size(1, 1)
6869     .groups(2)
6870     .group_input_channels(17)
6871     .group_output_channels(19)
6872     .qmin(128)
6873     .iterations(3)
6874     .TestNHWCxF16();
6875 }
6876 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_with_qmax)6877 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_with_qmax) {
6878   ConvolutionOperatorTester()
6879     .input_size(24, 25)
6880     .kernel_size(1, 1)
6881     .groups(2)
6882     .group_input_channels(17)
6883     .group_output_channels(19)
6884     .qmax(128)
6885     .iterations(3)
6886     .TestNHWCxF16();
6887 }
6888 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_with_input_stride)6889 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_with_input_stride) {
6890   ConvolutionOperatorTester()
6891     .input_size(24, 25)
6892     .kernel_size(1, 1)
6893     .groups(2)
6894     .input_channel_stride(37)
6895     .group_input_channels(17)
6896     .group_output_channels(19)
6897     .iterations(3)
6898     .TestNHWCxF16();
6899 }
6900 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_with_output_stride)6901 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_with_output_stride) {
6902   ConvolutionOperatorTester()
6903     .input_size(24, 25)
6904     .kernel_size(1, 1)
6905     .groups(2)
6906     .output_channel_stride(41)
6907     .group_input_channels(17)
6908     .group_output_channels(19)
6909     .iterations(3)
6910     .TestNHWCxF16();
6911 }
6912 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_without_bias)6913 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_without_bias) {
6914   ConvolutionOperatorTester()
6915     .has_bias(false)
6916     .input_size(24, 25)
6917     .kernel_size(1, 1)
6918     .groups(2)
6919     .group_input_channels(17)
6920     .group_output_channels(19)
6921     .iterations(3)
6922     .TestNHWCxF16();
6923 }
6924 
TEST(CONVOLUTION_NHWC_F16,grouped_1x1_with_batch)6925 TEST(CONVOLUTION_NHWC_F16, grouped_1x1_with_batch) {
6926   ConvolutionOperatorTester()
6927     .batch_size(3)
6928     .input_size(24, 25)
6929     .kernel_size(1, 1)
6930     .groups(2)
6931     .group_input_channels(17)
6932     .group_output_channels(19)
6933     .iterations(3)
6934     .TestNHWCxF16();
6935 }
6936 
TEST(CONVOLUTION_NHWC_F16,unioutput_1x1)6937 TEST(CONVOLUTION_NHWC_F16, unioutput_1x1) {
6938   ConvolutionOperatorTester()
6939     .input_size(1, 1)
6940     .kernel_size(1, 1)
6941     .group_input_channels(23)
6942     .group_output_channels(19)
6943     .iterations(3)
6944     .TestNHWCxF16();
6945 }
6946 
TEST(CONVOLUTION_NHWC_F16,unioutput_1x1_with_qmin)6947 TEST(CONVOLUTION_NHWC_F16, unioutput_1x1_with_qmin) {
6948   ConvolutionOperatorTester()
6949     .input_size(1, 1)
6950     .kernel_size(1, 1)
6951     .group_input_channels(23)
6952     .group_output_channels(19)
6953     .qmin(128)
6954     .iterations(3)
6955     .TestNHWCxF16();
6956 }
6957 
TEST(CONVOLUTION_NHWC_F16,unioutput_1x1_with_qmax)6958 TEST(CONVOLUTION_NHWC_F16, unioutput_1x1_with_qmax) {
6959   ConvolutionOperatorTester()
6960     .input_size(1, 1)
6961     .kernel_size(1, 1)
6962     .group_input_channels(23)
6963     .group_output_channels(19)
6964     .qmax(128)
6965     .iterations(3)
6966     .TestNHWCxF16();
6967 }
6968 
TEST(CONVOLUTION_NHWC_F16,unioutput_1x1_with_input_stride)6969 TEST(CONVOLUTION_NHWC_F16, unioutput_1x1_with_input_stride) {
6970   ConvolutionOperatorTester()
6971     .input_size(1, 1)
6972     .kernel_size(1, 1)
6973     .input_channel_stride(28)
6974     .group_input_channels(23)
6975     .group_output_channels(19)
6976     .iterations(3)
6977     .TestNHWCxF16();
6978 }
6979 
TEST(CONVOLUTION_NHWC_F16,unioutput_1x1_with_output_stride)6980 TEST(CONVOLUTION_NHWC_F16, unioutput_1x1_with_output_stride) {
6981   ConvolutionOperatorTester()
6982     .input_size(1, 1)
6983     .kernel_size(1, 1)
6984     .output_channel_stride(29)
6985     .group_input_channels(23)
6986     .group_output_channels(19)
6987     .iterations(3)
6988     .TestNHWCxF16();
6989 }
6990 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_1x1)6991 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_1x1) {
6992   ConvolutionOperatorTester()
6993     .input_size(1, 1)
6994     .kernel_size(1, 1)
6995     .groups(2)
6996     .group_input_channels(17)
6997     .group_output_channels(13)
6998     .iterations(3)
6999     .TestNHWCxF16();
7000 }
7001 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_1x1_with_qmin)7002 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_1x1_with_qmin) {
7003   ConvolutionOperatorTester()
7004     .input_size(1, 1)
7005     .kernel_size(1, 1)
7006     .groups(2)
7007     .group_input_channels(17)
7008     .group_output_channels(13)
7009     .qmin(128)
7010     .iterations(3)
7011     .TestNHWCxF16();
7012 }
7013 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_1x1_with_qmax)7014 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_1x1_with_qmax) {
7015   ConvolutionOperatorTester()
7016     .input_size(1, 1)
7017     .kernel_size(1, 1)
7018     .groups(2)
7019     .group_input_channels(17)
7020     .group_output_channels(13)
7021     .qmax(128)
7022     .iterations(3)
7023     .TestNHWCxF16();
7024 }
7025 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_1x1_with_input_stride)7026 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_1x1_with_input_stride) {
7027   ConvolutionOperatorTester()
7028     .input_size(1, 1)
7029     .kernel_size(1, 1)
7030     .groups(2)
7031     .input_channel_stride(37)
7032     .group_input_channels(17)
7033     .group_output_channels(13)
7034     .iterations(3)
7035     .TestNHWCxF16();
7036 }
7037 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_1x1_with_output_stride)7038 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_1x1_with_output_stride) {
7039   ConvolutionOperatorTester()
7040     .input_size(1, 1)
7041     .kernel_size(1, 1)
7042     .groups(2)
7043     .output_channel_stride(41)
7044     .group_input_channels(17)
7045     .group_output_channels(13)
7046     .iterations(3)
7047     .TestNHWCxF16();
7048 }
7049 
7050 TEST(CONVOLUTION_NHWC_F16, 1x3) {
7051   ConvolutionOperatorTester()
7052     .input_size(20, 19)
7053     .padding_width(1)
7054     .kernel_size(1, 3)
7055     .group_input_channels(17)
7056     .group_output_channels(15)
7057     .iterations(3)
7058     .TestNHWCxF16();
7059 }
7060 
TEST(CONVOLUTION_NHWC_F16,grouped_1x3)7061 TEST(CONVOLUTION_NHWC_F16, grouped_1x3) {
7062   ConvolutionOperatorTester()
7063     .input_size(20, 19)
7064     .padding_width(1)
7065     .kernel_size(1, 3)
7066     .groups(2)
7067     .group_input_channels(17)
7068     .group_output_channels(15)
7069     .iterations(3)
7070     .TestNHWCxF16();
7071 }
7072 
7073 TEST(CONVOLUTION_NHWC_F16, 3x1) {
7074   ConvolutionOperatorTester()
7075     .input_size(19, 20)
7076     .padding_height(1)
7077     .kernel_size(3, 1)
7078     .group_input_channels(17)
7079     .group_output_channels(15)
7080     .iterations(3)
7081     .TestNHWCxF16();
7082 }
7083 
TEST(CONVOLUTION_NHWC_F16,grouped_3x1)7084 TEST(CONVOLUTION_NHWC_F16, grouped_3x1) {
7085   ConvolutionOperatorTester()
7086     .input_size(19, 20)
7087     .padding_height(1)
7088     .kernel_size(3, 1)
7089     .groups(2)
7090     .group_input_channels(17)
7091     .group_output_channels(15)
7092     .iterations(3)
7093     .TestNHWCxF16();
7094 }
7095 
7096 TEST(CONVOLUTION_NHWC_F16, 3x3) {
7097   ConvolutionOperatorTester()
7098     .input_size(13, 12)
7099     .padding(1)
7100     .kernel_size(3, 3)
7101     .group_input_channels(15)
7102     .group_output_channels(17)
7103     .iterations(3)
7104     .TestNHWCxF16();
7105 }
7106 
7107 TEST(CONVOLUTION_NHWC_F16, 3x3_with_fp32_weights) {
7108   ConvolutionOperatorTester()
7109     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
7110     .input_size(13, 12)
7111     .padding(1)
7112     .kernel_size(3, 3)
7113     .group_input_channels(15)
7114     .group_output_channels(17)
7115     .iterations(3)
7116     .TestNHWCxF16();
7117 }
7118 
7119 TEST(CONVOLUTION_NHWC_F16, 3x3_without_padding) {
7120   ConvolutionOperatorTester()
7121     .input_size(13, 12)
7122     .kernel_size(3, 3)
7123     .group_input_channels(15)
7124     .group_output_channels(17)
7125     .iterations(3)
7126     .TestNHWCxF16();
7127 }
7128 
7129 TEST(CONVOLUTION_NHWC_F16, 3x3_with_left_padding) {
7130   ConvolutionOperatorTester()
7131     .input_size(13, 12)
7132     .padding_left(1)
7133     .kernel_size(3, 3)
7134     .group_input_channels(15)
7135     .group_output_channels(17)
7136     .iterations(3)
7137     .TestNHWCxF16();
7138 }
7139 
7140 TEST(CONVOLUTION_NHWC_F16, 3x3_with_right_padding) {
7141   ConvolutionOperatorTester()
7142     .input_size(13, 12)
7143     .padding_right(1)
7144     .kernel_size(3, 3)
7145     .group_input_channels(15)
7146     .group_output_channels(17)
7147     .iterations(3)
7148     .TestNHWCxF16();
7149 }
7150 
7151 TEST(CONVOLUTION_NHWC_F16, 3x3_with_top_padding) {
7152   ConvolutionOperatorTester()
7153     .input_size(13, 12)
7154     .padding_top(1)
7155     .kernel_size(3, 3)
7156     .group_input_channels(15)
7157     .group_output_channels(17)
7158     .iterations(3)
7159     .TestNHWCxF16();
7160 }
7161 
7162 TEST(CONVOLUTION_NHWC_F16, 3x3_with_bottom_padding) {
7163   ConvolutionOperatorTester()
7164     .input_size(13, 12)
7165     .padding_bottom(1)
7166     .kernel_size(3, 3)
7167     .group_input_channels(15)
7168     .group_output_channels(17)
7169     .iterations(3)
7170     .TestNHWCxF16();
7171 }
7172 
7173 TEST(CONVOLUTION_NHWC_F16, 3x3_with_input_stride) {
7174   ConvolutionOperatorTester()
7175     .input_size(13, 12)
7176     .padding(1)
7177     .kernel_size(3, 3)
7178     .input_channel_stride(22)
7179     .group_input_channels(15)
7180     .group_output_channels(17)
7181     .iterations(3)
7182     .TestNHWCxF16();
7183 }
7184 
7185 TEST(CONVOLUTION_NHWC_F16, 3x3_with_output_stride) {
7186   ConvolutionOperatorTester()
7187     .input_size(13, 12)
7188     .padding(1)
7189     .kernel_size(3, 3)
7190     .output_channel_stride(23)
7191     .group_input_channels(15)
7192     .group_output_channels(17)
7193     .iterations(3)
7194     .TestNHWCxF16();
7195 }
7196 
7197 TEST(CONVOLUTION_NHWC_F16, 3x3_without_bias) {
7198   ConvolutionOperatorTester()
7199     .has_bias(false)
7200     .input_size(10, 9)
7201     .padding(1)
7202     .kernel_size(3, 3)
7203     .group_input_channels(15)
7204     .group_output_channels(17)
7205     .iterations(3)
7206     .TestNHWCxF16();
7207 }
7208 
7209 TEST(CONVOLUTION_NHWC_F16, 3x3_with_batch) {
7210   ConvolutionOperatorTester()
7211     .batch_size(3)
7212     .input_size(10, 9)
7213     .padding(1)
7214     .kernel_size(3, 3)
7215     .group_input_channels(15)
7216     .group_output_channels(17)
7217     .iterations(3)
7218     .TestNHWCxF16();
7219 }
7220 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3)7221 TEST(CONVOLUTION_NHWC_F16, grouped_3x3) {
7222   ConvolutionOperatorTester()
7223     .input_size(10, 11)
7224     .padding(1)
7225     .kernel_size(3, 3)
7226     .groups(2)
7227     .group_input_channels(14)
7228     .group_output_channels(13)
7229     .iterations(3)
7230     .TestNHWCxF16();
7231 }
7232 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_fp32_weights)7233 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_fp32_weights) {
7234   ConvolutionOperatorTester()
7235     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
7236     .input_size(10, 11)
7237     .padding(1)
7238     .kernel_size(3, 3)
7239     .groups(2)
7240     .group_input_channels(14)
7241     .group_output_channels(13)
7242     .iterations(3)
7243     .TestNHWCxF16();
7244 }
7245 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_without_padding)7246 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_without_padding) {
7247   ConvolutionOperatorTester()
7248     .input_size(13, 12)
7249     .kernel_size(3, 3)
7250     .group_input_channels(15)
7251     .group_output_channels(17)
7252     .iterations(3)
7253     .TestNHWCxF16();
7254 }
7255 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_left_padding)7256 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_left_padding) {
7257   ConvolutionOperatorTester()
7258     .input_size(10, 11)
7259     .padding_left(1)
7260     .kernel_size(3, 3)
7261     .groups(2)
7262     .group_input_channels(14)
7263     .group_output_channels(13)
7264     .iterations(3)
7265     .TestNHWCxF16();
7266 }
7267 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_right_padding)7268 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_right_padding) {
7269   ConvolutionOperatorTester()
7270     .input_size(10, 11)
7271     .padding_right(1)
7272     .kernel_size(3, 3)
7273     .groups(2)
7274     .group_input_channels(14)
7275     .group_output_channels(13)
7276     .iterations(3)
7277     .TestNHWCxF16();
7278 }
7279 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_top_padding)7280 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_top_padding) {
7281   ConvolutionOperatorTester()
7282     .input_size(10, 11)
7283     .padding_top(1)
7284     .kernel_size(3, 3)
7285     .groups(2)
7286     .group_input_channels(14)
7287     .group_output_channels(13)
7288     .iterations(3)
7289     .TestNHWCxF16();
7290 }
7291 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_bottom_padding)7292 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_bottom_padding) {
7293   ConvolutionOperatorTester()
7294     .input_size(10, 11)
7295     .padding_bottom(1)
7296     .kernel_size(3, 3)
7297     .groups(2)
7298     .group_input_channels(14)
7299     .group_output_channels(13)
7300     .iterations(3)
7301     .TestNHWCxF16();
7302 }
7303 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_input_stride)7304 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_input_stride) {
7305   ConvolutionOperatorTester()
7306     .input_size(10, 11)
7307     .padding(1)
7308     .kernel_size(3, 3)
7309     .groups(2)
7310     .input_channel_stride(29)
7311     .group_input_channels(14)
7312     .group_output_channels(13)
7313     .iterations(3)
7314     .TestNHWCxF16();
7315 }
7316 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_output_stride)7317 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_output_stride) {
7318   ConvolutionOperatorTester()
7319     .input_size(10, 11)
7320     .padding(1)
7321     .kernel_size(3, 3)
7322     .groups(2)
7323     .output_channel_stride(31)
7324     .group_input_channels(14)
7325     .group_output_channels(13)
7326     .iterations(3)
7327     .TestNHWCxF16();
7328 }
7329 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_without_bias)7330 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_without_bias) {
7331   ConvolutionOperatorTester()
7332     .has_bias(false)
7333     .input_size(10, 11)
7334     .padding(1)
7335     .kernel_size(3, 3)
7336     .groups(2)
7337     .group_input_channels(14)
7338     .group_output_channels(13)
7339     .iterations(3)
7340     .TestNHWCxF16();
7341 }
7342 
TEST(CONVOLUTION_NHWC_F16,grouped_3x3_with_batch)7343 TEST(CONVOLUTION_NHWC_F16, grouped_3x3_with_batch) {
7344   ConvolutionOperatorTester()
7345     .batch_size(3)
7346     .input_size(10, 11)
7347     .padding(1)
7348     .kernel_size(3, 3)
7349     .groups(2)
7350     .group_input_channels(14)
7351     .group_output_channels(13)
7352     .iterations(3)
7353     .TestNHWCxF16();
7354 }
7355 
7356 TEST(CONVOLUTION_NHWC_F16, 3x3s2) {
7357   ConvolutionOperatorTester()
7358     .input_size(14, 13)
7359     .padding(1)
7360     .kernel_size(3, 3)
7361     .subsampling(2)
7362     .group_input_channels(27)
7363     .group_output_channels(19)
7364     .iterations(3)
7365     .TestNHWCxF16();
7366 }
7367 
7368 TEST(CONVOLUTION_NHWC_F16, 3x3s2_with_tf_same_padding) {
7369   for (size_t input_height = 13; input_height <= 14; input_height++) {
7370     for (size_t input_width = 13; input_width <= 14; input_width++) {
7371       ConvolutionOperatorTester()
7372         .input_size(input_height, input_width)
7373         .padding_tf_same(true)
7374         .kernel_size(3, 3)
7375         .subsampling(2)
7376         .group_input_channels(27)
7377         .group_output_channels(19)
7378         .iterations(3)
7379         .TestNHWCxF16();
7380     }
7381   }
7382 }
7383 
7384 TEST(CONVOLUTION_NHWC_F16, 3x3s1x2) {
7385   ConvolutionOperatorTester()
7386     .input_size(14, 13)
7387     .padding(1)
7388     .kernel_size(3, 3)
7389     .subsampling(1, 2)
7390     .group_input_channels(27)
7391     .group_output_channels(19)
7392     .iterations(3)
7393     .TestNHWCxF16();
7394 }
7395 
7396 TEST(CONVOLUTION_NHWC_F16, 3x3s1x2_with_tf_same_padding) {
7397   for (size_t input_height = 13; input_height <= 14; input_height++) {
7398     for (size_t input_width = 13; input_width <= 14; input_width++) {
7399       ConvolutionOperatorTester()
7400         .input_size(input_height, input_width)
7401         .padding_tf_same(true)
7402         .kernel_size(3, 3)
7403         .subsampling(1, 2)
7404         .group_input_channels(27)
7405         .group_output_channels(19)
7406         .iterations(3)
7407         .TestNHWCxF16();
7408     }
7409   }
7410 }
7411 
7412 TEST(CONVOLUTION_NHWC_F16, 3x3s2x1) {
7413   ConvolutionOperatorTester()
7414     .input_size(14, 13)
7415     .padding(1)
7416     .kernel_size(3, 3)
7417     .subsampling(2, 1)
7418     .group_input_channels(27)
7419     .group_output_channels(19)
7420     .iterations(3)
7421     .TestNHWCxF16();
7422 }
7423 
7424 TEST(CONVOLUTION_NHWC_F16, 3x3s2x1_with_tf_same_padding) {
7425   for (size_t input_height = 13; input_height <= 14; input_height++) {
7426     for (size_t input_width = 13; input_width <= 14; input_width++) {
7427       ConvolutionOperatorTester()
7428         .input_size(input_height, input_width)
7429         .padding_tf_same(true)
7430         .kernel_size(3, 3)
7431         .subsampling(2, 1)
7432         .group_input_channels(27)
7433         .group_output_channels(19)
7434         .iterations(3)
7435         .TestNHWCxF16();
7436     }
7437   }
7438 }
7439 
7440 TEST(CONVOLUTION_NHWC_F16, 3x3d2) {
7441   ConvolutionOperatorTester()
7442     .input_size(13, 14)
7443     .padding(2)
7444     .kernel_size(3, 3)
7445     .dilation(2)
7446     .group_input_channels(27)
7447     .group_output_channels(19)
7448     .iterations(3)
7449     .TestNHWCxF16();
7450 }
7451 
7452 TEST(CONVOLUTION_NHWC_F16, 3x3d1x2) {
7453   ConvolutionOperatorTester()
7454     .input_size(14, 15)
7455     .padding(1, 2)
7456     .kernel_size(3, 3)
7457     .dilation(1, 2)
7458     .group_input_channels(27)
7459     .group_output_channels(19)
7460     .iterations(3)
7461     .TestNHWCxF16();
7462 }
7463 
7464 TEST(CONVOLUTION_NHWC_F16, 3x3d2x1) {
7465   ConvolutionOperatorTester()
7466     .input_size(15, 14)
7467     .padding(2, 1)
7468     .kernel_size(3, 3)
7469     .dilation(2, 1)
7470     .group_input_channels(27)
7471     .group_output_channels(19)
7472     .iterations(3)
7473     .TestNHWCxF16();
7474 }
7475 
TEST(CONVOLUTION_NHWC_F16,unioutput_3x3)7476 TEST(CONVOLUTION_NHWC_F16, unioutput_3x3) {
7477   ConvolutionOperatorTester()
7478     .input_size(3, 3)
7479     .padding(1)
7480     .kernel_size(3, 3)
7481     .group_input_channels(23)
7482     .group_output_channels(19)
7483     .iterations(3)
7484     .TestNHWCxF16();
7485 }
7486 
TEST(CONVOLUTION_NHWC_F16,unioutput_3x3_with_qmin)7487 TEST(CONVOLUTION_NHWC_F16, unioutput_3x3_with_qmin) {
7488   ConvolutionOperatorTester()
7489     .input_size(3, 3)
7490     .padding(1)
7491     .kernel_size(3, 3)
7492     .group_input_channels(23)
7493     .group_output_channels(19)
7494     .qmin(128)
7495     .iterations(3)
7496     .TestNHWCxF16();
7497 }
7498 
TEST(CONVOLUTION_NHWC_F16,unioutput_3x3_with_qmax)7499 TEST(CONVOLUTION_NHWC_F16, unioutput_3x3_with_qmax) {
7500   ConvolutionOperatorTester()
7501     .input_size(3, 3)
7502     .padding(1)
7503     .kernel_size(3, 3)
7504     .group_input_channels(23)
7505     .group_output_channels(19)
7506     .qmax(128)
7507     .iterations(3)
7508     .TestNHWCxF16();
7509 }
7510 
TEST(CONVOLUTION_NHWC_F16,unioutput_3x3_with_input_stride)7511 TEST(CONVOLUTION_NHWC_F16, unioutput_3x3_with_input_stride) {
7512   ConvolutionOperatorTester()
7513     .input_size(3, 3)
7514     .padding(1)
7515     .kernel_size(3, 3)
7516     .input_channel_stride(28)
7517     .group_input_channels(23)
7518     .group_output_channels(19)
7519     .iterations(3)
7520     .TestNHWCxF16();
7521 }
7522 
TEST(CONVOLUTION_NHWC_F16,unioutput_3x3_with_output_stride)7523 TEST(CONVOLUTION_NHWC_F16, unioutput_3x3_with_output_stride) {
7524   ConvolutionOperatorTester()
7525     .input_size(3, 3)
7526     .padding(1)
7527     .kernel_size(3, 3)
7528     .output_channel_stride(29)
7529     .group_input_channels(23)
7530     .group_output_channels(19)
7531     .iterations(3)
7532     .TestNHWCxF16();
7533 }
7534 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_3x3)7535 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_3x3) {
7536   ConvolutionOperatorTester()
7537     .input_size(3, 3)
7538     .padding(1)
7539     .kernel_size(3, 3)
7540     .groups(2)
7541     .group_input_channels(17)
7542     .group_output_channels(13)
7543     .iterations(3)
7544     .TestNHWCxF16();
7545 }
7546 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_3x3_with_qmin)7547 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_3x3_with_qmin) {
7548   ConvolutionOperatorTester()
7549     .input_size(3, 3)
7550     .padding(1)
7551     .kernel_size(3, 3)
7552     .groups(2)
7553     .group_input_channels(17)
7554     .group_output_channels(13)
7555     .qmin(128)
7556     .iterations(3)
7557     .TestNHWCxF16();
7558 }
7559 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_3x3_with_qmax)7560 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_3x3_with_qmax) {
7561   ConvolutionOperatorTester()
7562     .input_size(3, 3)
7563     .padding(1)
7564     .kernel_size(3, 3)
7565     .groups(2)
7566     .group_input_channels(17)
7567     .group_output_channels(13)
7568     .qmax(128)
7569     .iterations(3)
7570     .TestNHWCxF16();
7571 }
7572 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_3x3_with_input_stride)7573 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_3x3_with_input_stride) {
7574   ConvolutionOperatorTester()
7575     .input_size(3, 3)
7576     .padding(1)
7577     .kernel_size(3, 3)
7578     .groups(2)
7579     .input_channel_stride(37)
7580     .group_input_channels(17)
7581     .group_output_channels(13)
7582     .iterations(3)
7583     .TestNHWCxF16();
7584 }
7585 
TEST(CONVOLUTION_NHWC_F16,unioutput_grouped_3x3_with_output_stride)7586 TEST(CONVOLUTION_NHWC_F16, unioutput_grouped_3x3_with_output_stride) {
7587   ConvolutionOperatorTester()
7588     .input_size(3, 3)
7589     .padding(1)
7590     .kernel_size(3, 3)
7591     .groups(2)
7592     .output_channel_stride(41)
7593     .group_input_channels(17)
7594     .group_output_channels(13)
7595     .iterations(3)
7596     .TestNHWCxF16();
7597 }
7598 
TEST(CONVOLUTION_NHWC_F16,depthwise_1x1)7599 TEST(CONVOLUTION_NHWC_F16, depthwise_1x1) {
7600   ConvolutionOperatorTester()
7601     .input_size(15, 14)
7602     .kernel_size(1, 1)
7603     .groups(24)
7604     .iterations(3)
7605     .TestNHWCxF16();
7606 }
7607 
TEST(CONVOLUTION_NHWC_F16,depthwise_1x1_with_fp32_weights)7608 TEST(CONVOLUTION_NHWC_F16, depthwise_1x1_with_fp32_weights) {
7609   ConvolutionOperatorTester()
7610     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
7611     .input_size(15, 14)
7612     .kernel_size(1, 1)
7613     .groups(24)
7614     .iterations(3)
7615     .TestNHWCxF16();
7616 }
7617 
TEST(CONVOLUTION_NHWC_F16,depthwise_1x1_without_bias)7618 TEST(CONVOLUTION_NHWC_F16, depthwise_1x1_without_bias) {
7619   ConvolutionOperatorTester()
7620     .has_bias(false)
7621     .input_size(15, 14)
7622     .kernel_size(1, 1)
7623     .groups(24)
7624     .iterations(3)
7625     .TestNHWCxF16();
7626 }
7627 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2)7628 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2) {
7629   ConvolutionOperatorTester()
7630     .input_size(15, 14)
7631     .padding(1, 1)
7632     .kernel_size(2, 2)
7633     .groups(24)
7634     .iterations(3)
7635     .TestNHWCxF16();
7636 }
7637 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2_without_bias)7638 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2_without_bias) {
7639   ConvolutionOperatorTester()
7640     .has_bias(false)
7641     .input_size(15, 14)
7642     .padding(1, 1)
7643     .kernel_size(2, 2)
7644     .groups(24)
7645     .iterations(3)
7646     .TestNHWCxF16();
7647 }
7648 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2s2)7649 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2s2) {
7650   ConvolutionOperatorTester()
7651     .input_size(15, 14)
7652     .padding(1, 1)
7653     .kernel_size(2, 2)
7654     .subsampling(2)
7655     .groups(27)
7656     .iterations(3)
7657     .TestNHWCxF16();
7658 }
7659 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2s1x2)7660 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2s1x2) {
7661   ConvolutionOperatorTester()
7662     .input_size(15, 14)
7663     .padding(1, 1)
7664     .kernel_size(2, 2)
7665     .subsampling(1, 2)
7666     .groups(27)
7667     .iterations(3)
7668     .TestNHWCxF16();
7669 }
7670 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2s2x1)7671 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2s2x1) {
7672   ConvolutionOperatorTester()
7673     .input_size(15, 14)
7674     .padding(1, 1)
7675     .kernel_size(2, 2)
7676     .subsampling(2, 1)
7677     .groups(27)
7678     .iterations(3)
7679     .TestNHWCxF16();
7680 }
7681 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2d2)7682 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2d2) {
7683   ConvolutionOperatorTester()
7684     .input_size(15, 14)
7685     .padding(1, 1)
7686     .kernel_size(2, 2)
7687     .dilation(2)
7688     .groups(27)
7689     .iterations(3)
7690     .TestNHWCxF16();
7691 }
7692 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2d1x2)7693 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2d1x2) {
7694   ConvolutionOperatorTester()
7695     .input_size(15, 14)
7696     .padding(1, 1)
7697     .kernel_size(2, 2)
7698     .dilation(1, 2)
7699     .groups(27)
7700     .iterations(3)
7701     .TestNHWCxF16();
7702 }
7703 
TEST(CONVOLUTION_NHWC_F16,depthwise_2x2d2x1)7704 TEST(CONVOLUTION_NHWC_F16, depthwise_2x2d2x1) {
7705   ConvolutionOperatorTester()
7706     .input_size(15, 14)
7707     .padding(1, 1)
7708     .kernel_size(2, 2)
7709     .dilation(2, 1)
7710     .groups(27)
7711     .iterations(3)
7712     .TestNHWCxF16();
7713 }
7714 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3)7715 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3) {
7716   ConvolutionOperatorTester()
7717     .input_size(15, 14)
7718     .padding(1, 1)
7719     .kernel_size(3, 3)
7720     .groups(24)
7721     .iterations(3)
7722     .TestNHWCxF16();
7723 }
7724 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3_with_fp32_weights)7725 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3_with_fp32_weights) {
7726   ConvolutionOperatorTester()
7727     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
7728     .input_size(15, 14)
7729     .padding(1, 1)
7730     .kernel_size(3, 3)
7731     .groups(24)
7732     .iterations(3)
7733     .TestNHWCxF16();
7734 }
7735 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3_without_bias)7736 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3_without_bias) {
7737   ConvolutionOperatorTester()
7738     .has_bias(false)
7739     .input_size(15, 14)
7740     .padding(1, 1)
7741     .kernel_size(3, 3)
7742     .groups(24)
7743     .iterations(3)
7744     .TestNHWCxF16();
7745 }
7746 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3s2)7747 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3s2) {
7748   ConvolutionOperatorTester()
7749     .input_size(15, 14)
7750     .padding(1, 1)
7751     .kernel_size(3, 3)
7752     .subsampling(2)
7753     .groups(27)
7754     .iterations(3)
7755     .TestNHWCxF16();
7756 }
7757 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3s2_with_tf_same_padding)7758 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3s2_with_tf_same_padding) {
7759   for (size_t input_height = 14; input_height <= 15; input_height++) {
7760     for (size_t input_width = 14; input_width <= 15; input_width++) {
7761       ConvolutionOperatorTester()
7762         .input_size(input_height, input_width)
7763         .padding_tf_same(true)
7764         .kernel_size(3, 3)
7765         .subsampling(2)
7766         .groups(27)
7767         .iterations(3)
7768         .TestNHWCxF16();
7769     }
7770   }
7771 }
7772 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3s1x2)7773 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3s1x2) {
7774   ConvolutionOperatorTester()
7775     .input_size(15, 14)
7776     .padding(1, 1)
7777     .kernel_size(3, 3)
7778     .subsampling(1, 2)
7779     .groups(27)
7780     .iterations(3)
7781     .TestNHWCxF16();
7782 }
7783 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3s1x2_with_tf_same_padding)7784 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3s1x2_with_tf_same_padding) {
7785   for (size_t input_height = 14; input_height <= 15; input_height++) {
7786     for (size_t input_width = 14; input_width <= 15; input_width++) {
7787       ConvolutionOperatorTester()
7788         .input_size(input_height, input_width)
7789         .padding_tf_same(true)
7790         .kernel_size(3, 3)
7791         .subsampling(1, 2)
7792         .groups(27)
7793         .iterations(3)
7794         .TestNHWCxF16();
7795     }
7796   }
7797 }
7798 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3s2x1)7799 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3s2x1) {
7800   ConvolutionOperatorTester()
7801     .input_size(15, 14)
7802     .padding(1, 1)
7803     .kernel_size(3, 3)
7804     .subsampling(2, 1)
7805     .groups(27)
7806     .iterations(3)
7807     .TestNHWCxF16();
7808 }
7809 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3s2x1_with_tf_same_padding)7810 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3s2x1_with_tf_same_padding) {
7811   for (size_t input_height = 14; input_height <= 15; input_height++) {
7812     for (size_t input_width = 14; input_width <= 15; input_width++) {
7813       ConvolutionOperatorTester()
7814         .input_size(input_height, input_width)
7815         .padding_tf_same(true)
7816         .kernel_size(3, 3)
7817         .subsampling(2, 1)
7818         .groups(27)
7819         .iterations(3)
7820         .TestNHWCxF16();
7821     }
7822   }
7823 }
7824 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3d2)7825 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3d2) {
7826   ConvolutionOperatorTester()
7827     .input_size(15, 14)
7828     .padding(1, 1)
7829     .kernel_size(3, 3)
7830     .dilation(2)
7831     .groups(27)
7832     .iterations(3)
7833     .TestNHWCxF16();
7834 }
7835 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3d1x2)7836 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3d1x2) {
7837   ConvolutionOperatorTester()
7838     .input_size(15, 14)
7839     .padding(1, 1)
7840     .kernel_size(3, 3)
7841     .dilation(1, 2)
7842     .groups(27)
7843     .iterations(3)
7844     .TestNHWCxF16();
7845 }
7846 
TEST(CONVOLUTION_NHWC_F16,depthwise_3x3d2x1)7847 TEST(CONVOLUTION_NHWC_F16, depthwise_3x3d2x1) {
7848   ConvolutionOperatorTester()
7849     .input_size(15, 14)
7850     .padding(1, 1)
7851     .kernel_size(3, 3)
7852     .dilation(2, 1)
7853     .groups(27)
7854     .iterations(3)
7855     .TestNHWCxF16();
7856 }
7857 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5)7858 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5) {
7859   ConvolutionOperatorTester()
7860     .input_size(15, 14)
7861     .padding(2, 2)
7862     .kernel_size(5, 5)
7863     .groups(27)
7864     .iterations(3)
7865     .TestNHWCxF16();
7866 }
7867 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5_without_bias)7868 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5_without_bias) {
7869   ConvolutionOperatorTester()
7870     .has_bias(false)
7871     .input_size(15, 14)
7872     .padding(2, 2)
7873     .kernel_size(5, 5)
7874     .groups(27)
7875     .iterations(3)
7876     .TestNHWCxF16();
7877 }
7878 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5s2)7879 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5s2) {
7880   ConvolutionOperatorTester()
7881     .input_size(15, 14)
7882     .padding(2, 2)
7883     .kernel_size(5, 5)
7884     .subsampling(2)
7885     .groups(27)
7886     .iterations(3)
7887     .TestNHWCxF16();
7888 }
7889 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5s1x2)7890 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5s1x2) {
7891   ConvolutionOperatorTester()
7892     .input_size(15, 14)
7893     .padding(2, 2)
7894     .kernel_size(5, 5)
7895     .subsampling(1, 2)
7896     .groups(27)
7897     .iterations(3)
7898     .TestNHWCxF16();
7899 }
7900 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5s2x1)7901 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5s2x1) {
7902   ConvolutionOperatorTester()
7903     .input_size(15, 14)
7904     .padding(2, 2)
7905     .kernel_size(5, 5)
7906     .subsampling(2, 1)
7907     .groups(27)
7908     .iterations(3)
7909     .TestNHWCxF16();
7910 }
7911 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5d2)7912 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5d2) {
7913   ConvolutionOperatorTester()
7914     .input_size(15, 14)
7915     .padding(2, 2)
7916     .kernel_size(5, 5)
7917     .dilation(2)
7918     .groups(27)
7919     .iterations(3)
7920     .TestNHWCxF16();
7921 }
7922 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5d1x2)7923 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5d1x2) {
7924   ConvolutionOperatorTester()
7925     .input_size(15, 14)
7926     .padding(2, 2)
7927     .kernel_size(5, 5)
7928     .dilation(1, 2)
7929     .groups(27)
7930     .iterations(3)
7931     .TestNHWCxF16();
7932 }
7933 
TEST(CONVOLUTION_NHWC_F16,depthwise_5x5d2x1)7934 TEST(CONVOLUTION_NHWC_F16, depthwise_5x5d2x1) {
7935   ConvolutionOperatorTester()
7936     .input_size(15, 14)
7937     .padding(2, 2)
7938     .kernel_size(5, 5)
7939     .dilation(2, 1)
7940     .groups(27)
7941     .iterations(3)
7942     .TestNHWCxF16();
7943 }
7944 
7945 // Tests GEMM microkernel with weights_cache.
TEST(CONVOLUTION_NHWC_F16,weights_cache_1x1)7946 TEST(CONVOLUTION_NHWC_F16, weights_cache_1x1) {
7947   ConvolutionOperatorTester()
7948     .input_size(27, 29)
7949     .kernel_size(1, 1)
7950     .group_input_channels(23)
7951     .group_output_channels(19)
7952     .use_weights_cache(true)
7953     .iterations(3)
7954     .TestNHWCxF16();
7955 }
7956 
7957 // Tests IGEMM microkernel with weights cache.
TEST(CONVOLUTION_NHWC_F16,weights_cache_3x3)7958 TEST(CONVOLUTION_NHWC_F16, weights_cache_3x3) {
7959   ConvolutionOperatorTester()
7960     .input_size(13, 12)
7961     .padding(1)
7962     .kernel_size(3, 3)
7963     .group_input_channels(15)
7964     .group_output_channels(17)
7965     .use_weights_cache(true)
7966     .iterations(3)
7967     .TestNHWCxF16();
7968 }
7969 
7970 // Tests vmulcaddc microkernel with weights cache.
TEST(CONVOLUTION_NHWC_F16,weights_cache_depthwise_1x1)7971 TEST(CONVOLUTION_NHWC_F16, weights_cache_depthwise_1x1) {
7972   ConvolutionOperatorTester()
7973     .input_size(15, 14)
7974     .kernel_size(1, 1)
7975     .groups(24)
7976     .use_weights_cache(true)
7977     .iterations(3)
7978     .TestNHWCxF16();
7979 }
7980 
7981 // Tests dwconv microkernel with weights cache.
TEST(CONVOLUTION_NHWC_F16,weights_cache_depthwise_2x2d2)7982 TEST(CONVOLUTION_NHWC_F16, weights_cache_depthwise_2x2d2) {
7983   ConvolutionOperatorTester()
7984     .input_size(15, 14)
7985     .padding(1, 1)
7986     .kernel_size(2, 2)
7987     .dilation(2)
7988     .groups(27)
7989     .iterations(3)
7990     .use_weights_cache(true)
7991     .TestNHWCxF16();
7992 }
7993 
7994 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 1x1) {
7995   ConvolutionOperatorTester()
7996     .depthwise_layout(true)
7997     .input_size(15, 14)
7998     .kernel_size(1, 1)
7999     .groups(24)
8000     .iterations(3)
8001     .TestNHWCxF16();
8002 }
8003 
8004 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 1x1_with_fp32_weights) {
8005   ConvolutionOperatorTester()
8006     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
8007     .depthwise_layout(true)
8008     .input_size(15, 14)
8009     .kernel_size(1, 1)
8010     .groups(24)
8011     .iterations(3)
8012     .TestNHWCxF16();
8013 }
8014 
8015 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 1x1_with_depth_multiplier) {
8016   ConvolutionOperatorTester()
8017     .depthwise_layout(true)
8018     .input_size(15, 14)
8019     .kernel_size(1, 1)
8020     .groups(24)
8021     .group_output_channels(3)
8022     .iterations(3)
8023     .TestNHWCxF16();
8024 }
8025 
8026 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 1x1_with_depth_multiplier_with_fp32_weights) {
8027   ConvolutionOperatorTester()
8028     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
8029     .depthwise_layout(true)
8030     .input_size(15, 14)
8031     .kernel_size(1, 1)
8032     .groups(24)
8033     .group_output_channels(3)
8034     .iterations(3)
8035     .TestNHWCxF16();
8036 }
8037 
8038 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 1x1_without_bias) {
8039   ConvolutionOperatorTester()
8040     .depthwise_layout(true)
8041     .has_bias(false)
8042     .input_size(15, 14)
8043     .kernel_size(1, 1)
8044     .groups(24)
8045     .iterations(3)
8046     .TestNHWCxF16();
8047 }
8048 
8049 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 2x2) {
8050   ConvolutionOperatorTester()
8051     .depthwise_layout(true)
8052     .input_size(15, 14)
8053     .padding(1, 1)
8054     .kernel_size(2, 2)
8055     .groups(24)
8056     .iterations(3)
8057     .TestNHWCxF16();
8058 }
8059 
8060 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 2x2_with_depth_multiplier) {
8061   ConvolutionOperatorTester()
8062     .depthwise_layout(true)
8063     .input_size(15, 14)
8064     .padding(1, 1)
8065     .kernel_size(2, 2)
8066     .groups(24)
8067     .group_output_channels(3)
8068     .iterations(3)
8069     .TestNHWCxF16();
8070 }
8071 
8072 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 2x2_without_bias) {
8073   ConvolutionOperatorTester()
8074     .depthwise_layout(true)
8075     .has_bias(false)
8076     .input_size(15, 14)
8077     .padding(1, 1)
8078     .kernel_size(2, 2)
8079     .groups(24)
8080     .iterations(3)
8081     .TestNHWCxF16();
8082 }
8083 
8084 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 3x3) {
8085   ConvolutionOperatorTester()
8086     .depthwise_layout(true)
8087     .input_size(15, 14)
8088     .padding(1, 1)
8089     .kernel_size(3, 3)
8090     .groups(24)
8091     .iterations(3)
8092     .TestNHWCxF16();
8093 }
8094 
8095 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 3x3_weight_fp32_weights) {
8096   ConvolutionOperatorTester()
8097     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
8098     .depthwise_layout(true)
8099     .input_size(15, 14)
8100     .padding(1, 1)
8101     .kernel_size(3, 3)
8102     .groups(24)
8103     .iterations(3)
8104     .TestNHWCxF16();
8105 }
8106 
8107 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 3x3_with_depth_multiplier) {
8108   ConvolutionOperatorTester()
8109     .depthwise_layout(true)
8110     .input_size(15, 14)
8111     .padding(1, 1)
8112     .kernel_size(3, 3)
8113     .groups(24)
8114     .group_output_channels(3)
8115     .iterations(3)
8116     .TestNHWCxF16();
8117 }
8118 
8119 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 3x3_with_depth_multiplier_with_fp32_weights) {
8120   ConvolutionOperatorTester()
8121     .weights_type(ConvolutionOperatorTester::WeightsType::FP32)
8122     .depthwise_layout(true)
8123     .input_size(15, 14)
8124     .padding(1, 1)
8125     .kernel_size(3, 3)
8126     .groups(24)
8127     .group_output_channels(3)
8128     .iterations(3)
8129     .TestNHWCxF16();
8130 }
8131 
8132 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 3x3_without_bias) {
8133   ConvolutionOperatorTester()
8134     .depthwise_layout(true)
8135     .has_bias(false)
8136     .input_size(15, 14)
8137     .padding(1, 1)
8138     .kernel_size(3, 3)
8139     .groups(24)
8140     .iterations(3)
8141     .TestNHWCxF16();
8142 }
8143 
8144 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 3x3s2_with_tf_same_padding) {
8145   for (size_t input_height = 14; input_height <= 15; input_height++) {
8146     for (size_t input_width = 14; input_width <= 15; input_width++) {
8147       ConvolutionOperatorTester()
8148         .depthwise_layout(true)
8149         .input_size(input_height, input_width)
8150         .padding_tf_same(true)
8151         .kernel_size(3, 3)
8152         .groups(24)
8153         .iterations(3)
8154         .TestNHWCxF16();
8155     }
8156   }
8157 }
8158 
8159 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 5x5) {
8160   ConvolutionOperatorTester()
8161     .depthwise_layout(true)
8162     .input_size(15, 14)
8163     .padding(2, 2)
8164     .kernel_size(5, 5)
8165     .groups(24)
8166     .iterations(3)
8167     .TestNHWCxF16();
8168 }
8169 
8170 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 5x5_with_depth_multiplier) {
8171   ConvolutionOperatorTester()
8172     .depthwise_layout(true)
8173     .input_size(15, 14)
8174     .padding(2, 2)
8175     .kernel_size(5, 5)
8176     .groups(24)
8177     .group_output_channels(3)
8178     .iterations(3)
8179     .TestNHWCxF16();
8180 }
8181 
8182 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 5x5_without_bias) {
8183   ConvolutionOperatorTester()
8184     .depthwise_layout(true)
8185     .has_bias(false)
8186     .input_size(15, 14)
8187     .padding(2, 2)
8188     .kernel_size(5, 5)
8189     .groups(24)
8190     .iterations(3)
8191     .TestNHWCxF16();
8192 }
8193 
8194 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 7x7) {
8195   ConvolutionOperatorTester()
8196     .depthwise_layout(true)
8197     .input_size(15, 14)
8198     .padding(3, 3)
8199     .kernel_size(7, 7)
8200     .groups(24)
8201     .iterations(3)
8202     .TestNHWCxF16();
8203 }
8204 
8205 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, 7x7_without_bias) {
8206   ConvolutionOperatorTester()
8207     .depthwise_layout(true)
8208     .has_bias(false)
8209     .input_size(15, 14)
8210     .padding(3, 3)
8211     .kernel_size(7, 7)
8212     .groups(24)
8213     .iterations(3)
8214     .TestNHWCxF16();
8215 }
8216 
8217 // Tests dwconv microkernel with weights cache.
TEST(DEPTHWISE_CONVOLUTION_NHWC_F16,weights_cache_1x1)8218 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, weights_cache_1x1) {
8219   ConvolutionOperatorTester()
8220     .depthwise_layout(true)
8221     .input_size(15, 14)
8222     .kernel_size(1, 1)
8223     .groups(24)
8224     .use_weights_cache(true)
8225     .iterations(3)
8226     .TestNHWCxF16();
8227 }
8228 
8229 // Tests dwconv microkernek with non 1x1 kernel (dwconv_hwg packing).
TEST(DEPTHWISE_CONVOLUTION_NHWC_F16,weights_cache_2x2)8230 TEST(DEPTHWISE_CONVOLUTION_NHWC_F16, weights_cache_2x2) {
8231   ConvolutionOperatorTester()
8232     .depthwise_layout(true)
8233     .input_size(15, 14)
8234     .padding(1, 1)
8235     .kernel_size(2, 2)
8236     .groups(24)
8237     .use_weights_cache(true)
8238     .iterations(3)
8239     .TestNHWCxF16();
8240 }
8241 
TEST(CONVOLUTION_NHWC_F16,setup_changing_input_buffer)8242 TEST(CONVOLUTION_NHWC_F16, setup_changing_input_buffer) {
8243   ConvolutionOperatorTester()
8244     .batch_size(3)
8245     .input_height(8)
8246     .input_width(8)
8247     .kernel_height(5)
8248     .kernel_width(3)
8249     .group_input_channels(15)
8250     .group_output_channels(17)
8251     .TestSetupNHWCxF16();
8252 }
8253 
TEST(CONVOLUTION_NHWC_F16,setup_changing_input_buffer_grouped)8254 TEST(CONVOLUTION_NHWC_F16, setup_changing_input_buffer_grouped) {
8255   ConvolutionOperatorTester()
8256     .batch_size(3)
8257     .input_height(8)
8258     .input_width(8)
8259     .kernel_height(5)
8260     .kernel_width(3)
8261     .groups(2)
8262     .group_input_channels(15)
8263     .group_output_channels(17)
8264     .TestSetupNHWCxF16();
8265 }
8266 
TEST(CONVOLUTION_NHWC_F16,setup_changing_input_buffer_depthwise)8267 TEST(CONVOLUTION_NHWC_F16, setup_changing_input_buffer_depthwise) {
8268   ConvolutionOperatorTester()
8269     .batch_size(3)
8270     .input_height(8)
8271     .input_width(8)
8272     .kernel_height(3)
8273     .kernel_width(3)
8274     .groups(19)
8275     .group_input_channels(1)
8276     .group_output_channels(1)
8277     .TestSetupNHWCxF16();
8278 }
8279 
TEST(CONVOLUTION_NHWC_F16,setup_increasing_batch)8280 TEST(CONVOLUTION_NHWC_F16, setup_increasing_batch) {
8281   ConvolutionOperatorTester()
8282     .batch_size(3)
8283     .next_batch_size(5)
8284     .input_height(8)
8285     .input_width(8)
8286     .kernel_height(5)
8287     .kernel_width(3)
8288     .group_input_channels(15)
8289     .group_output_channels(17)
8290     .TestSetupNHWCxF16();
8291 }
8292 
TEST(CONVOLUTION_NHWC_F16,setup_increasing_batch_grouped)8293 TEST(CONVOLUTION_NHWC_F16, setup_increasing_batch_grouped) {
8294   ConvolutionOperatorTester()
8295     .batch_size(3)
8296     .next_batch_size(5)
8297     .input_height(8)
8298     .input_width(8)
8299     .kernel_height(5)
8300     .kernel_width(3)
8301     .groups(2)
8302     .group_input_channels(15)
8303     .group_output_channels(17)
8304     .TestSetupNHWCxF16();
8305 }
8306 
TEST(CONVOLUTION_NHWC_F16,setup_increasing_batch_depthwise)8307 TEST(CONVOLUTION_NHWC_F16, setup_increasing_batch_depthwise) {
8308   ConvolutionOperatorTester()
8309     .batch_size(3)
8310     .next_batch_size(5)
8311     .input_height(8)
8312     .input_width(8)
8313     .kernel_height(3)
8314     .kernel_width(3)
8315     .groups(19)
8316     .group_input_channels(1)
8317     .group_output_channels(1)
8318     .TestSetupNHWCxF16();
8319 }
8320 
TEST(CONVOLUTION_NHWC_F16,setup_decreasing_batch)8321 TEST(CONVOLUTION_NHWC_F16, setup_decreasing_batch) {
8322   ConvolutionOperatorTester()
8323     .batch_size(5)
8324     .next_batch_size(3)
8325     .input_height(8)
8326     .input_width(8)
8327     .kernel_height(5)
8328     .kernel_width(3)
8329     .group_input_channels(15)
8330     .group_output_channels(17)
8331     .TestSetupNHWCxF16();
8332 }
8333 
TEST(CONVOLUTION_NHWC_F16,setup_decreasing_batch_grouped)8334 TEST(CONVOLUTION_NHWC_F16, setup_decreasing_batch_grouped) {
8335   ConvolutionOperatorTester()
8336     .batch_size(5)
8337     .next_batch_size(3)
8338     .input_height(8)
8339     .input_width(8)
8340     .kernel_height(5)
8341     .kernel_width(3)
8342     .groups(2)
8343     .group_input_channels(15)
8344     .group_output_channels(17)
8345     .TestSetupNHWCxF16();
8346 }
8347 
TEST(CONVOLUTION_NHWC_F16,setup_decreasing_batch_depthwise)8348 TEST(CONVOLUTION_NHWC_F16, setup_decreasing_batch_depthwise) {
8349   ConvolutionOperatorTester()
8350     .batch_size(5)
8351     .next_batch_size(3)
8352     .input_height(8)
8353     .input_width(8)
8354     .kernel_height(3)
8355     .kernel_width(3)
8356     .groups(19)
8357     .group_input_channels(1)
8358     .group_output_channels(1)
8359     .TestSetupNHWCxF16();
8360 }
8361 
TEST(CONVOLUTION_NHWC_F16,setup_changing_height)8362 TEST(CONVOLUTION_NHWC_F16, setup_changing_height) {
8363   ConvolutionOperatorTester()
8364     .batch_size(3)
8365     .input_height(8)
8366     .input_width(8)
8367     .next_input_height(9)
8368     .kernel_height(5)
8369     .kernel_width(3)
8370     .group_input_channels(15)
8371     .group_output_channels(17)
8372     .TestSetupNHWCxF16();
8373   ConvolutionOperatorTester()
8374     .batch_size(3)
8375     .input_height(8)
8376     .input_width(8)
8377     .next_input_height(7)
8378     .kernel_height(5)
8379     .kernel_width(3)
8380     .group_input_channels(15)
8381     .group_output_channels(17)
8382     .TestSetupNHWCxF16();
8383 }
8384 
TEST(CONVOLUTION_NHWC_F16,setup_changing_height_grouped)8385 TEST(CONVOLUTION_NHWC_F16, setup_changing_height_grouped) {
8386   ConvolutionOperatorTester()
8387     .batch_size(3)
8388     .input_height(8)
8389     .input_width(8)
8390     .next_input_height(9)
8391     .kernel_height(5)
8392     .kernel_width(3)
8393     .groups(2)
8394     .group_input_channels(15)
8395     .group_output_channels(17)
8396     .TestSetupNHWCxF16();
8397   ConvolutionOperatorTester()
8398     .batch_size(3)
8399     .input_height(8)
8400     .input_width(8)
8401     .next_input_height(7)
8402     .kernel_height(5)
8403     .kernel_width(3)
8404     .groups(2)
8405     .group_input_channels(15)
8406     .group_output_channels(17)
8407     .TestSetupNHWCxF16();
8408 }
8409 
TEST(CONVOLUTION_NHWC_F16,setup_changing_height_depthwise)8410 TEST(CONVOLUTION_NHWC_F16, setup_changing_height_depthwise) {
8411   ConvolutionOperatorTester()
8412     .batch_size(3)
8413     .input_height(8)
8414     .input_width(8)
8415     .next_input_height(9)
8416     .kernel_height(3)
8417     .kernel_width(3)
8418     .groups(19)
8419     .group_input_channels(1)
8420     .group_output_channels(1)
8421     .TestSetupNHWCxF16();
8422   ConvolutionOperatorTester()
8423     .batch_size(3)
8424     .input_height(8)
8425     .input_width(8)
8426     .next_input_height(7)
8427     .kernel_height(3)
8428     .kernel_width(3)
8429     .groups(19)
8430     .group_input_channels(1)
8431     .group_output_channels(1)
8432     .TestSetupNHWCxF16();
8433 }
8434 
TEST(CONVOLUTION_NHWC_F16,setup_changing_width)8435 TEST(CONVOLUTION_NHWC_F16, setup_changing_width) {
8436   ConvolutionOperatorTester()
8437     .batch_size(3)
8438     .input_height(8)
8439     .input_width(8)
8440     .next_input_width(9)
8441     .kernel_height(5)
8442     .kernel_width(3)
8443     .group_input_channels(15)
8444     .group_output_channels(17)
8445     .TestSetupNHWCxF16();
8446   ConvolutionOperatorTester()
8447     .batch_size(3)
8448     .input_height(8)
8449     .input_width(8)
8450     .next_input_width(7)
8451     .kernel_height(5)
8452     .kernel_width(3)
8453     .group_input_channels(15)
8454     .group_output_channels(17)
8455     .TestSetupNHWCxF16();
8456 }
8457 
TEST(CONVOLUTION_NHWC_F16,setup_changing_width_grouped)8458 TEST(CONVOLUTION_NHWC_F16, setup_changing_width_grouped) {
8459   ConvolutionOperatorTester()
8460     .batch_size(3)
8461     .input_height(8)
8462     .input_width(8)
8463     .next_input_width(9)
8464     .kernel_height(5)
8465     .kernel_width(3)
8466     .groups(2)
8467     .group_input_channels(15)
8468     .group_output_channels(17)
8469     .TestSetupNHWCxF16();
8470   ConvolutionOperatorTester()
8471     .batch_size(3)
8472     .input_height(8)
8473     .input_width(8)
8474     .next_input_width(7)
8475     .kernel_height(5)
8476     .kernel_width(3)
8477     .groups(2)
8478     .group_input_channels(15)
8479     .group_output_channels(17)
8480     .TestSetupNHWCxF16();
8481 }
8482 
TEST(CONVOLUTION_NHWC_F16,setup_changing_width_depthwise)8483 TEST(CONVOLUTION_NHWC_F16, setup_changing_width_depthwise) {
8484   ConvolutionOperatorTester()
8485     .batch_size(3)
8486     .input_height(8)
8487     .input_width(8)
8488     .next_input_width(9)
8489     .kernel_height(3)
8490     .kernel_width(3)
8491     .groups(19)
8492     .group_input_channels(1)
8493     .group_output_channels(1)
8494     .TestSetupNHWCxF16();
8495   ConvolutionOperatorTester()
8496     .batch_size(3)
8497     .input_height(8)
8498     .input_width(8)
8499     .next_input_width(7)
8500     .kernel_height(3)
8501     .kernel_width(3)
8502     .groups(19)
8503     .group_input_channels(1)
8504     .group_output_channels(1)
8505     .TestSetupNHWCxF16();
8506 }
8507 
TEST(CONVOLUTION_NHWC_F16,setup_swap_height_and_width)8508 TEST(CONVOLUTION_NHWC_F16, setup_swap_height_and_width) {
8509   ConvolutionOperatorTester()
8510     .batch_size(3)
8511     .input_height(9)
8512     .input_width(8)
8513     .next_input_height(8)
8514     .next_input_width(9)
8515     .kernel_height(5)
8516     .kernel_width(3)
8517     .group_input_channels(15)
8518     .group_output_channels(17)
8519     .TestSetupNHWCxF16();
8520 }
8521 
TEST(CONVOLUTION_NHWC_F16,setup_swap_height_and_width_grouped)8522 TEST(CONVOLUTION_NHWC_F16, setup_swap_height_and_width_grouped) {
8523   ConvolutionOperatorTester()
8524     .batch_size(3)
8525     .input_height(9)
8526     .input_width(8)
8527     .next_input_height(8)
8528     .next_input_width(9)
8529     .kernel_height(5)
8530     .kernel_width(3)
8531     .groups(2)
8532     .group_input_channels(15)
8533     .group_output_channels(17)
8534     .TestSetupNHWCxF16();
8535 }
8536 
TEST(CONVOLUTION_NHWC_F16,setup_swap_height_and_width_depthwise)8537 TEST(CONVOLUTION_NHWC_F16, setup_swap_height_and_width_depthwise) {
8538   ConvolutionOperatorTester()
8539     .batch_size(3)
8540     .input_height(9)
8541     .input_width(8)
8542     .next_input_height(8)
8543     .next_input_width(9)
8544     .kernel_height(3)
8545     .kernel_width(3)
8546     .groups(19)
8547     .group_input_channels(1)
8548     .group_output_channels(1)
8549     .TestSetupNHWCxF16();
8550 }
8551