1*4bdc9457SAndroid Build Coastguard Worker // Copyright (c) Facebook, Inc. and its affiliates.
2*4bdc9457SAndroid Build Coastguard Worker // All rights reserved.
3*4bdc9457SAndroid Build Coastguard Worker //
4*4bdc9457SAndroid Build Coastguard Worker // Copyright 2019 Google LLC
5*4bdc9457SAndroid Build Coastguard Worker //
6*4bdc9457SAndroid Build Coastguard Worker // This source code is licensed under the BSD-style license found in the
7*4bdc9457SAndroid Build Coastguard Worker // LICENSE file in the root directory of this source tree.
8*4bdc9457SAndroid Build Coastguard Worker
9*4bdc9457SAndroid Build Coastguard Worker #include <algorithm>
10*4bdc9457SAndroid Build Coastguard Worker #include <cstddef>
11*4bdc9457SAndroid Build Coastguard Worker #include <cstdint>
12*4bdc9457SAndroid Build Coastguard Worker
13*4bdc9457SAndroid Build Coastguard Worker #include <gtest/gtest.h>
14*4bdc9457SAndroid Build Coastguard Worker
15*4bdc9457SAndroid Build Coastguard Worker #include "global-average-pooling-operator-tester.h"
16*4bdc9457SAndroid Build Coastguard Worker
17*4bdc9457SAndroid Build Coastguard Worker #include <xnnpack/params.h>
18*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width)19*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width) {
20*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
21*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
22*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
23*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
24*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
25*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
26*4bdc9457SAndroid Build Coastguard Worker .width(width)
27*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
28*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
29*4bdc9457SAndroid Build Coastguard Worker }
30*4bdc9457SAndroid Build Coastguard Worker }
31*4bdc9457SAndroid Build Coastguard Worker }
32*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_input_stride)33*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_input_stride) {
34*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
35*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
36*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
37*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
38*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
39*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
40*4bdc9457SAndroid Build Coastguard Worker .width(width)
41*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
42*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
43*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
44*4bdc9457SAndroid Build Coastguard Worker }
45*4bdc9457SAndroid Build Coastguard Worker }
46*4bdc9457SAndroid Build Coastguard Worker }
47*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_input_scale)48*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_input_scale) {
49*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
50*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
51*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
52*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
53*4bdc9457SAndroid Build Coastguard Worker for (float input_scale = 0.01f; input_scale < 100.0f; input_scale *= 3.14159265f) {
54*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
55*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
56*4bdc9457SAndroid Build Coastguard Worker .width(width)
57*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
58*4bdc9457SAndroid Build Coastguard Worker .input_scale(input_scale)
59*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
60*4bdc9457SAndroid Build Coastguard Worker }
61*4bdc9457SAndroid Build Coastguard Worker }
62*4bdc9457SAndroid Build Coastguard Worker }
63*4bdc9457SAndroid Build Coastguard Worker }
64*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_input_zero_point)65*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_input_zero_point) {
66*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
67*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
68*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
69*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
70*4bdc9457SAndroid Build Coastguard Worker for (int32_t input_zero_point = 0; input_zero_point <= 255; input_zero_point += 51) {
71*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
72*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
73*4bdc9457SAndroid Build Coastguard Worker .width(width)
74*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
75*4bdc9457SAndroid Build Coastguard Worker .input_zero_point(uint8_t(input_zero_point))
76*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
77*4bdc9457SAndroid Build Coastguard Worker }
78*4bdc9457SAndroid Build Coastguard Worker }
79*4bdc9457SAndroid Build Coastguard Worker }
80*4bdc9457SAndroid Build Coastguard Worker }
81*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_output_scale)82*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_output_scale) {
83*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
84*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
85*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
86*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
87*4bdc9457SAndroid Build Coastguard Worker for (float output_scale = 0.01f; output_scale < 100.0f; output_scale *= 3.14159265f) {
88*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
89*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
90*4bdc9457SAndroid Build Coastguard Worker .width(width)
91*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
92*4bdc9457SAndroid Build Coastguard Worker .output_scale(output_scale)
93*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
94*4bdc9457SAndroid Build Coastguard Worker }
95*4bdc9457SAndroid Build Coastguard Worker }
96*4bdc9457SAndroid Build Coastguard Worker }
97*4bdc9457SAndroid Build Coastguard Worker }
98*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_output_zero_point)99*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_output_zero_point) {
100*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
101*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
102*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
103*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
104*4bdc9457SAndroid Build Coastguard Worker for (int32_t output_zero_point = 0; output_zero_point <= 255; output_zero_point += 51) {
105*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
106*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
107*4bdc9457SAndroid Build Coastguard Worker .width(width)
108*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
109*4bdc9457SAndroid Build Coastguard Worker .output_zero_point(uint8_t(output_zero_point))
110*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
111*4bdc9457SAndroid Build Coastguard Worker }
112*4bdc9457SAndroid Build Coastguard Worker }
113*4bdc9457SAndroid Build Coastguard Worker }
114*4bdc9457SAndroid Build Coastguard Worker }
115*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_qmin)116*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_qmin) {
117*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
118*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
119*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
120*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
121*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
122*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
123*4bdc9457SAndroid Build Coastguard Worker .width(width)
124*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
125*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
126*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
127*4bdc9457SAndroid Build Coastguard Worker }
128*4bdc9457SAndroid Build Coastguard Worker }
129*4bdc9457SAndroid Build Coastguard Worker }
130*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_small_width_with_qmax)131*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_small_width_with_qmax) {
132*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
133*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
134*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
135*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
136*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
137*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
138*4bdc9457SAndroid Build Coastguard Worker .width(width)
139*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
140*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
141*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
142*4bdc9457SAndroid Build Coastguard Worker }
143*4bdc9457SAndroid Build Coastguard Worker }
144*4bdc9457SAndroid Build Coastguard Worker }
145*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width)146*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width) {
147*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
148*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
149*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
150*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
151*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
152*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
153*4bdc9457SAndroid Build Coastguard Worker .width(width)
154*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
155*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
156*4bdc9457SAndroid Build Coastguard Worker }
157*4bdc9457SAndroid Build Coastguard Worker }
158*4bdc9457SAndroid Build Coastguard Worker }
159*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_input_stride)160*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_input_stride) {
161*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
162*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
163*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
164*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
165*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
166*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
167*4bdc9457SAndroid Build Coastguard Worker .width(width)
168*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
169*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
170*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
171*4bdc9457SAndroid Build Coastguard Worker }
172*4bdc9457SAndroid Build Coastguard Worker }
173*4bdc9457SAndroid Build Coastguard Worker }
174*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_input_scale)175*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_input_scale) {
176*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
177*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
178*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
179*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
180*4bdc9457SAndroid Build Coastguard Worker for (float input_scale = 0.01f; input_scale < 100.0f; input_scale *= 3.14159265f) {
181*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
182*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
183*4bdc9457SAndroid Build Coastguard Worker .width(width)
184*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
185*4bdc9457SAndroid Build Coastguard Worker .input_scale(input_scale)
186*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
187*4bdc9457SAndroid Build Coastguard Worker }
188*4bdc9457SAndroid Build Coastguard Worker }
189*4bdc9457SAndroid Build Coastguard Worker }
190*4bdc9457SAndroid Build Coastguard Worker }
191*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_input_zero_point)192*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_input_zero_point) {
193*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
194*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
195*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
196*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
197*4bdc9457SAndroid Build Coastguard Worker for (int32_t input_zero_point = 0; input_zero_point <= 255; input_zero_point += 51) {
198*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
199*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
200*4bdc9457SAndroid Build Coastguard Worker .width(width)
201*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
202*4bdc9457SAndroid Build Coastguard Worker .input_zero_point(uint8_t(input_zero_point))
203*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
204*4bdc9457SAndroid Build Coastguard Worker }
205*4bdc9457SAndroid Build Coastguard Worker }
206*4bdc9457SAndroid Build Coastguard Worker }
207*4bdc9457SAndroid Build Coastguard Worker }
208*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_output_scale)209*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_output_scale) {
210*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
211*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
212*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
213*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
214*4bdc9457SAndroid Build Coastguard Worker for (float output_scale = 0.01f; output_scale < 100.0f; output_scale *= 3.14159265f) {
215*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
216*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
217*4bdc9457SAndroid Build Coastguard Worker .width(width)
218*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
219*4bdc9457SAndroid Build Coastguard Worker .output_scale(output_scale)
220*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
221*4bdc9457SAndroid Build Coastguard Worker }
222*4bdc9457SAndroid Build Coastguard Worker }
223*4bdc9457SAndroid Build Coastguard Worker }
224*4bdc9457SAndroid Build Coastguard Worker }
225*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_output_zero_point)226*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_output_zero_point) {
227*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
228*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
229*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
230*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
231*4bdc9457SAndroid Build Coastguard Worker for (int32_t output_zero_point = 0; output_zero_point <= 255; output_zero_point += 51) {
232*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
233*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
234*4bdc9457SAndroid Build Coastguard Worker .width(width)
235*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
236*4bdc9457SAndroid Build Coastguard Worker .output_zero_point(uint8_t(output_zero_point))
237*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
238*4bdc9457SAndroid Build Coastguard Worker }
239*4bdc9457SAndroid Build Coastguard Worker }
240*4bdc9457SAndroid Build Coastguard Worker }
241*4bdc9457SAndroid Build Coastguard Worker }
242*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_qmin)243*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_qmin) {
244*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
245*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
246*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
247*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
248*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
249*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
250*4bdc9457SAndroid Build Coastguard Worker .width(width)
251*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
252*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
253*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
254*4bdc9457SAndroid Build Coastguard Worker }
255*4bdc9457SAndroid Build Coastguard Worker }
256*4bdc9457SAndroid Build Coastguard Worker }
257*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,unit_batch_large_width_with_qmax)258*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, unit_batch_large_width_with_qmax) {
259*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
260*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
261*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
262*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
263*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
264*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
265*4bdc9457SAndroid Build Coastguard Worker .width(width)
266*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
267*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
268*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
269*4bdc9457SAndroid Build Coastguard Worker }
270*4bdc9457SAndroid Build Coastguard Worker }
271*4bdc9457SAndroid Build Coastguard Worker }
272*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,small_batch_small_width)273*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, small_batch_small_width) {
274*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
275*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
276*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
277*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
278*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
279*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
280*4bdc9457SAndroid Build Coastguard Worker .width(width)
281*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
282*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
283*4bdc9457SAndroid Build Coastguard Worker }
284*4bdc9457SAndroid Build Coastguard Worker }
285*4bdc9457SAndroid Build Coastguard Worker }
286*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,small_batch_small_width_with_input_stride)287*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, small_batch_small_width_with_input_stride) {
288*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
289*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
290*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
291*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
292*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
293*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
294*4bdc9457SAndroid Build Coastguard Worker .width(width)
295*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
296*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
297*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
298*4bdc9457SAndroid Build Coastguard Worker }
299*4bdc9457SAndroid Build Coastguard Worker }
300*4bdc9457SAndroid Build Coastguard Worker }
301*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,small_batch_small_width_with_output_stride)302*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, small_batch_small_width_with_output_stride) {
303*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
304*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
305*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
306*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
307*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
308*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
309*4bdc9457SAndroid Build Coastguard Worker .width(width)
310*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
311*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
312*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
313*4bdc9457SAndroid Build Coastguard Worker }
314*4bdc9457SAndroid Build Coastguard Worker }
315*4bdc9457SAndroid Build Coastguard Worker }
316*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,small_batch_large_width)317*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, small_batch_large_width) {
318*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
319*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
320*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
321*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
322*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
323*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
324*4bdc9457SAndroid Build Coastguard Worker .width(width)
325*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
326*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
327*4bdc9457SAndroid Build Coastguard Worker }
328*4bdc9457SAndroid Build Coastguard Worker }
329*4bdc9457SAndroid Build Coastguard Worker }
330*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,small_batch_large_width_with_input_stride)331*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, small_batch_large_width_with_input_stride) {
332*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
333*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
334*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
335*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
336*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
337*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
338*4bdc9457SAndroid Build Coastguard Worker .width(width)
339*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
340*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
341*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
342*4bdc9457SAndroid Build Coastguard Worker }
343*4bdc9457SAndroid Build Coastguard Worker }
344*4bdc9457SAndroid Build Coastguard Worker }
345*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8,small_batch_large_width_with_output_stride)346*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QU8, small_batch_large_width_with_output_stride) {
347*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
348*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qu8.gavgpool.row_tile, 1);
349*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
350*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
351*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
352*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
353*4bdc9457SAndroid Build Coastguard Worker .width(width)
354*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
355*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
356*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQU8();
357*4bdc9457SAndroid Build Coastguard Worker }
358*4bdc9457SAndroid Build Coastguard Worker }
359*4bdc9457SAndroid Build Coastguard Worker }
360*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width)361*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width) {
362*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
363*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
364*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
365*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
366*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
367*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
368*4bdc9457SAndroid Build Coastguard Worker .width(width)
369*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
370*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
371*4bdc9457SAndroid Build Coastguard Worker }
372*4bdc9457SAndroid Build Coastguard Worker }
373*4bdc9457SAndroid Build Coastguard Worker }
374*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_input_stride)375*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_input_stride) {
376*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
377*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
378*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
379*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
380*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
381*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
382*4bdc9457SAndroid Build Coastguard Worker .width(width)
383*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
384*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
385*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
386*4bdc9457SAndroid Build Coastguard Worker }
387*4bdc9457SAndroid Build Coastguard Worker }
388*4bdc9457SAndroid Build Coastguard Worker }
389*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_input_scale)390*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_input_scale) {
391*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
392*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
393*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
394*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
395*4bdc9457SAndroid Build Coastguard Worker for (float input_scale = 0.01f; input_scale < 100.0f; input_scale *= 3.14159265f) {
396*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
397*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
398*4bdc9457SAndroid Build Coastguard Worker .width(width)
399*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
400*4bdc9457SAndroid Build Coastguard Worker .input_scale(input_scale)
401*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
402*4bdc9457SAndroid Build Coastguard Worker }
403*4bdc9457SAndroid Build Coastguard Worker }
404*4bdc9457SAndroid Build Coastguard Worker }
405*4bdc9457SAndroid Build Coastguard Worker }
406*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_input_zero_point)407*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_input_zero_point) {
408*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
409*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
410*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
411*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
412*4bdc9457SAndroid Build Coastguard Worker for (int32_t input_zero_point = 0; input_zero_point <= 255; input_zero_point += 51) {
413*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
414*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
415*4bdc9457SAndroid Build Coastguard Worker .width(width)
416*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
417*4bdc9457SAndroid Build Coastguard Worker .input_zero_point(uint8_t(input_zero_point))
418*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
419*4bdc9457SAndroid Build Coastguard Worker }
420*4bdc9457SAndroid Build Coastguard Worker }
421*4bdc9457SAndroid Build Coastguard Worker }
422*4bdc9457SAndroid Build Coastguard Worker }
423*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_output_scale)424*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_output_scale) {
425*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
426*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
427*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
428*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
429*4bdc9457SAndroid Build Coastguard Worker for (float output_scale = 0.01f; output_scale < 100.0f; output_scale *= 3.14159265f) {
430*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
431*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
432*4bdc9457SAndroid Build Coastguard Worker .width(width)
433*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
434*4bdc9457SAndroid Build Coastguard Worker .output_scale(output_scale)
435*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
436*4bdc9457SAndroid Build Coastguard Worker }
437*4bdc9457SAndroid Build Coastguard Worker }
438*4bdc9457SAndroid Build Coastguard Worker }
439*4bdc9457SAndroid Build Coastguard Worker }
440*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_output_zero_point)441*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_output_zero_point) {
442*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
443*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
444*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
445*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
446*4bdc9457SAndroid Build Coastguard Worker for (int32_t output_zero_point = 0; output_zero_point <= 255; output_zero_point += 51) {
447*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
448*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
449*4bdc9457SAndroid Build Coastguard Worker .width(width)
450*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
451*4bdc9457SAndroid Build Coastguard Worker .output_zero_point(uint8_t(output_zero_point))
452*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
453*4bdc9457SAndroid Build Coastguard Worker }
454*4bdc9457SAndroid Build Coastguard Worker }
455*4bdc9457SAndroid Build Coastguard Worker }
456*4bdc9457SAndroid Build Coastguard Worker }
457*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_qmin)458*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_qmin) {
459*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
460*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
461*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
462*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
463*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
464*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
465*4bdc9457SAndroid Build Coastguard Worker .width(width)
466*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
467*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
468*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
469*4bdc9457SAndroid Build Coastguard Worker }
470*4bdc9457SAndroid Build Coastguard Worker }
471*4bdc9457SAndroid Build Coastguard Worker }
472*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_small_width_with_qmax)473*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_small_width_with_qmax) {
474*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
475*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
476*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
477*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
478*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
479*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
480*4bdc9457SAndroid Build Coastguard Worker .width(width)
481*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
482*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
483*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
484*4bdc9457SAndroid Build Coastguard Worker }
485*4bdc9457SAndroid Build Coastguard Worker }
486*4bdc9457SAndroid Build Coastguard Worker }
487*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width)488*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width) {
489*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
490*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
491*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
492*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
493*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
494*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
495*4bdc9457SAndroid Build Coastguard Worker .width(width)
496*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
497*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
498*4bdc9457SAndroid Build Coastguard Worker }
499*4bdc9457SAndroid Build Coastguard Worker }
500*4bdc9457SAndroid Build Coastguard Worker }
501*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_input_stride)502*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_input_stride) {
503*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
504*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
505*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
506*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
507*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
508*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
509*4bdc9457SAndroid Build Coastguard Worker .width(width)
510*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
511*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
512*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
513*4bdc9457SAndroid Build Coastguard Worker }
514*4bdc9457SAndroid Build Coastguard Worker }
515*4bdc9457SAndroid Build Coastguard Worker }
516*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_input_scale)517*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_input_scale) {
518*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
519*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
520*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
521*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
522*4bdc9457SAndroid Build Coastguard Worker for (float input_scale = 0.01f; input_scale < 100.0f; input_scale *= 3.14159265f) {
523*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
524*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
525*4bdc9457SAndroid Build Coastguard Worker .width(width)
526*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
527*4bdc9457SAndroid Build Coastguard Worker .input_scale(input_scale)
528*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
529*4bdc9457SAndroid Build Coastguard Worker }
530*4bdc9457SAndroid Build Coastguard Worker }
531*4bdc9457SAndroid Build Coastguard Worker }
532*4bdc9457SAndroid Build Coastguard Worker }
533*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_input_zero_point)534*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_input_zero_point) {
535*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
536*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
537*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
538*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
539*4bdc9457SAndroid Build Coastguard Worker for (int32_t input_zero_point = 0; input_zero_point <= 255; input_zero_point += 51) {
540*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
541*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
542*4bdc9457SAndroid Build Coastguard Worker .width(width)
543*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
544*4bdc9457SAndroid Build Coastguard Worker .input_zero_point(uint8_t(input_zero_point))
545*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
546*4bdc9457SAndroid Build Coastguard Worker }
547*4bdc9457SAndroid Build Coastguard Worker }
548*4bdc9457SAndroid Build Coastguard Worker }
549*4bdc9457SAndroid Build Coastguard Worker }
550*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_output_scale)551*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_output_scale) {
552*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
553*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
554*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
555*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
556*4bdc9457SAndroid Build Coastguard Worker for (float output_scale = 0.01f; output_scale < 100.0f; output_scale *= 3.14159265f) {
557*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
558*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
559*4bdc9457SAndroid Build Coastguard Worker .width(width)
560*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
561*4bdc9457SAndroid Build Coastguard Worker .output_scale(output_scale)
562*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
563*4bdc9457SAndroid Build Coastguard Worker }
564*4bdc9457SAndroid Build Coastguard Worker }
565*4bdc9457SAndroid Build Coastguard Worker }
566*4bdc9457SAndroid Build Coastguard Worker }
567*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_output_zero_point)568*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_output_zero_point) {
569*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
570*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
571*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
572*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
573*4bdc9457SAndroid Build Coastguard Worker for (int32_t output_zero_point = 0; output_zero_point <= 255; output_zero_point += 51) {
574*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
575*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
576*4bdc9457SAndroid Build Coastguard Worker .width(width)
577*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
578*4bdc9457SAndroid Build Coastguard Worker .output_zero_point(uint8_t(output_zero_point))
579*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
580*4bdc9457SAndroid Build Coastguard Worker }
581*4bdc9457SAndroid Build Coastguard Worker }
582*4bdc9457SAndroid Build Coastguard Worker }
583*4bdc9457SAndroid Build Coastguard Worker }
584*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_qmin)585*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_qmin) {
586*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
587*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
588*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
589*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
590*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
591*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
592*4bdc9457SAndroid Build Coastguard Worker .width(width)
593*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
594*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
595*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
596*4bdc9457SAndroid Build Coastguard Worker }
597*4bdc9457SAndroid Build Coastguard Worker }
598*4bdc9457SAndroid Build Coastguard Worker }
599*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,unit_batch_large_width_with_qmax)600*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, unit_batch_large_width_with_qmax) {
601*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
602*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
603*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
604*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
605*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
606*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
607*4bdc9457SAndroid Build Coastguard Worker .width(width)
608*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
609*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
610*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
611*4bdc9457SAndroid Build Coastguard Worker }
612*4bdc9457SAndroid Build Coastguard Worker }
613*4bdc9457SAndroid Build Coastguard Worker }
614*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,small_batch_small_width)615*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, small_batch_small_width) {
616*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
617*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
618*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
619*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
620*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
621*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
622*4bdc9457SAndroid Build Coastguard Worker .width(width)
623*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
624*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
625*4bdc9457SAndroid Build Coastguard Worker }
626*4bdc9457SAndroid Build Coastguard Worker }
627*4bdc9457SAndroid Build Coastguard Worker }
628*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,small_batch_small_width_with_input_stride)629*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, small_batch_small_width_with_input_stride) {
630*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
631*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
632*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
633*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
634*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
635*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
636*4bdc9457SAndroid Build Coastguard Worker .width(width)
637*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
638*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
639*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
640*4bdc9457SAndroid Build Coastguard Worker }
641*4bdc9457SAndroid Build Coastguard Worker }
642*4bdc9457SAndroid Build Coastguard Worker }
643*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,small_batch_small_width_with_output_stride)644*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, small_batch_small_width_with_output_stride) {
645*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
646*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
647*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
648*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
649*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
650*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
651*4bdc9457SAndroid Build Coastguard Worker .width(width)
652*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
653*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
654*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
655*4bdc9457SAndroid Build Coastguard Worker }
656*4bdc9457SAndroid Build Coastguard Worker }
657*4bdc9457SAndroid Build Coastguard Worker }
658*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,small_batch_large_width)659*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, small_batch_large_width) {
660*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
661*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
662*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
663*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
664*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
665*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
666*4bdc9457SAndroid Build Coastguard Worker .width(width)
667*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
668*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
669*4bdc9457SAndroid Build Coastguard Worker }
670*4bdc9457SAndroid Build Coastguard Worker }
671*4bdc9457SAndroid Build Coastguard Worker }
672*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,small_batch_large_width_with_input_stride)673*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, small_batch_large_width_with_input_stride) {
674*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
675*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
676*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
677*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
678*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
679*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
680*4bdc9457SAndroid Build Coastguard Worker .width(width)
681*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
682*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
683*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
684*4bdc9457SAndroid Build Coastguard Worker }
685*4bdc9457SAndroid Build Coastguard Worker }
686*4bdc9457SAndroid Build Coastguard Worker }
687*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8,small_batch_large_width_with_output_stride)688*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_QS8, small_batch_large_width_with_output_stride) {
689*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
690*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.qs8.gavgpool.row_tile, 1);
691*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
692*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
693*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
694*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
695*4bdc9457SAndroid Build Coastguard Worker .width(width)
696*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
697*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
698*4bdc9457SAndroid Build Coastguard Worker .TestNWCxQS8();
699*4bdc9457SAndroid Build Coastguard Worker }
700*4bdc9457SAndroid Build Coastguard Worker }
701*4bdc9457SAndroid Build Coastguard Worker }
702*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_small_width)703*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_small_width) {
704*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
705*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
706*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
707*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
708*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
709*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
710*4bdc9457SAndroid Build Coastguard Worker .width(width)
711*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
712*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
713*4bdc9457SAndroid Build Coastguard Worker }
714*4bdc9457SAndroid Build Coastguard Worker }
715*4bdc9457SAndroid Build Coastguard Worker }
716*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_small_width_with_input_stride)717*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_small_width_with_input_stride) {
718*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
719*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
720*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
721*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
722*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
723*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
724*4bdc9457SAndroid Build Coastguard Worker .width(width)
725*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
726*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
727*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
728*4bdc9457SAndroid Build Coastguard Worker }
729*4bdc9457SAndroid Build Coastguard Worker }
730*4bdc9457SAndroid Build Coastguard Worker }
731*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_small_width_with_qmin)732*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_small_width_with_qmin) {
733*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
734*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
735*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
736*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
737*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
738*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
739*4bdc9457SAndroid Build Coastguard Worker .width(width)
740*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
741*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
742*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
743*4bdc9457SAndroid Build Coastguard Worker }
744*4bdc9457SAndroid Build Coastguard Worker }
745*4bdc9457SAndroid Build Coastguard Worker }
746*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_small_width_with_qmax)747*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_small_width_with_qmax) {
748*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
749*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
750*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
751*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
752*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
753*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
754*4bdc9457SAndroid Build Coastguard Worker .width(width)
755*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
756*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
757*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
758*4bdc9457SAndroid Build Coastguard Worker }
759*4bdc9457SAndroid Build Coastguard Worker }
760*4bdc9457SAndroid Build Coastguard Worker }
761*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_large_width)762*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_large_width) {
763*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
764*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
765*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
766*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
767*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
768*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
769*4bdc9457SAndroid Build Coastguard Worker .width(width)
770*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
771*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
772*4bdc9457SAndroid Build Coastguard Worker }
773*4bdc9457SAndroid Build Coastguard Worker }
774*4bdc9457SAndroid Build Coastguard Worker }
775*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_large_width_with_input_stride)776*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_large_width_with_input_stride) {
777*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
778*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
779*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
780*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
781*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
782*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
783*4bdc9457SAndroid Build Coastguard Worker .width(width)
784*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
785*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
786*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
787*4bdc9457SAndroid Build Coastguard Worker }
788*4bdc9457SAndroid Build Coastguard Worker }
789*4bdc9457SAndroid Build Coastguard Worker }
790*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_large_width_with_qmin)791*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_large_width_with_qmin) {
792*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
793*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
794*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
795*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
796*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
797*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
798*4bdc9457SAndroid Build Coastguard Worker .width(width)
799*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
800*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
801*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
802*4bdc9457SAndroid Build Coastguard Worker }
803*4bdc9457SAndroid Build Coastguard Worker }
804*4bdc9457SAndroid Build Coastguard Worker }
805*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,unit_batch_large_width_with_qmax)806*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, unit_batch_large_width_with_qmax) {
807*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
808*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
809*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
810*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
811*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
812*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
813*4bdc9457SAndroid Build Coastguard Worker .width(width)
814*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
815*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
816*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
817*4bdc9457SAndroid Build Coastguard Worker }
818*4bdc9457SAndroid Build Coastguard Worker }
819*4bdc9457SAndroid Build Coastguard Worker }
820*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,small_batch_small_width)821*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, small_batch_small_width) {
822*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
823*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
824*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
825*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
826*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
827*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
828*4bdc9457SAndroid Build Coastguard Worker .width(width)
829*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
830*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
831*4bdc9457SAndroid Build Coastguard Worker }
832*4bdc9457SAndroid Build Coastguard Worker }
833*4bdc9457SAndroid Build Coastguard Worker }
834*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,small_batch_small_width_with_input_stride)835*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, small_batch_small_width_with_input_stride) {
836*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
837*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
838*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
839*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
840*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
841*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
842*4bdc9457SAndroid Build Coastguard Worker .width(width)
843*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
844*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
845*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
846*4bdc9457SAndroid Build Coastguard Worker }
847*4bdc9457SAndroid Build Coastguard Worker }
848*4bdc9457SAndroid Build Coastguard Worker }
849*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,small_batch_small_width_with_output_stride)850*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, small_batch_small_width_with_output_stride) {
851*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
852*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
853*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
854*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
855*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
856*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
857*4bdc9457SAndroid Build Coastguard Worker .width(width)
858*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
859*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
860*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
861*4bdc9457SAndroid Build Coastguard Worker }
862*4bdc9457SAndroid Build Coastguard Worker }
863*4bdc9457SAndroid Build Coastguard Worker }
864*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,small_batch_large_width)865*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, small_batch_large_width) {
866*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
867*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
868*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
869*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
870*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
871*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
872*4bdc9457SAndroid Build Coastguard Worker .width(width)
873*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
874*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
875*4bdc9457SAndroid Build Coastguard Worker }
876*4bdc9457SAndroid Build Coastguard Worker }
877*4bdc9457SAndroid Build Coastguard Worker }
878*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,small_batch_large_width_with_input_stride)879*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, small_batch_large_width_with_input_stride) {
880*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
881*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
882*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
883*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
884*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
885*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
886*4bdc9457SAndroid Build Coastguard Worker .width(width)
887*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
888*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
889*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
890*4bdc9457SAndroid Build Coastguard Worker }
891*4bdc9457SAndroid Build Coastguard Worker }
892*4bdc9457SAndroid Build Coastguard Worker }
893*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F16,small_batch_large_width_with_output_stride)894*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F16, small_batch_large_width_with_output_stride) {
895*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
896*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f16.gavgpool.row_tile, 1);
897*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
898*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
899*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
900*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
901*4bdc9457SAndroid Build Coastguard Worker .width(width)
902*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
903*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
904*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF16();
905*4bdc9457SAndroid Build Coastguard Worker }
906*4bdc9457SAndroid Build Coastguard Worker }
907*4bdc9457SAndroid Build Coastguard Worker }
908*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_small_width)909*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_small_width) {
910*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
911*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
912*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
913*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
914*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
915*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
916*4bdc9457SAndroid Build Coastguard Worker .width(width)
917*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
918*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
919*4bdc9457SAndroid Build Coastguard Worker }
920*4bdc9457SAndroid Build Coastguard Worker }
921*4bdc9457SAndroid Build Coastguard Worker }
922*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_small_width_with_input_stride)923*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_small_width_with_input_stride) {
924*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
925*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
926*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
927*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
928*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
929*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
930*4bdc9457SAndroid Build Coastguard Worker .width(width)
931*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
932*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
933*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
934*4bdc9457SAndroid Build Coastguard Worker }
935*4bdc9457SAndroid Build Coastguard Worker }
936*4bdc9457SAndroid Build Coastguard Worker }
937*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_small_width_with_qmin)938*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_small_width_with_qmin) {
939*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
940*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
941*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
942*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
943*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
944*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
945*4bdc9457SAndroid Build Coastguard Worker .width(width)
946*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
947*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
948*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
949*4bdc9457SAndroid Build Coastguard Worker }
950*4bdc9457SAndroid Build Coastguard Worker }
951*4bdc9457SAndroid Build Coastguard Worker }
952*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_small_width_with_qmax)953*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_small_width_with_qmax) {
954*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
955*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
956*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
957*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
958*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
959*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
960*4bdc9457SAndroid Build Coastguard Worker .width(width)
961*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
962*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
963*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
964*4bdc9457SAndroid Build Coastguard Worker }
965*4bdc9457SAndroid Build Coastguard Worker }
966*4bdc9457SAndroid Build Coastguard Worker }
967*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_large_width)968*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_large_width) {
969*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
970*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
971*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
972*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
973*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
974*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
975*4bdc9457SAndroid Build Coastguard Worker .width(width)
976*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
977*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
978*4bdc9457SAndroid Build Coastguard Worker }
979*4bdc9457SAndroid Build Coastguard Worker }
980*4bdc9457SAndroid Build Coastguard Worker }
981*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_large_width_with_input_stride)982*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_large_width_with_input_stride) {
983*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
984*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
985*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
986*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
987*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
988*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
989*4bdc9457SAndroid Build Coastguard Worker .width(width)
990*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
991*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
992*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
993*4bdc9457SAndroid Build Coastguard Worker }
994*4bdc9457SAndroid Build Coastguard Worker }
995*4bdc9457SAndroid Build Coastguard Worker }
996*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_large_width_with_qmin)997*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_large_width_with_qmin) {
998*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
999*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1000*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1001*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
1002*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1003*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
1004*4bdc9457SAndroid Build Coastguard Worker .width(width)
1005*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1006*4bdc9457SAndroid Build Coastguard Worker .qmin(128)
1007*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1008*4bdc9457SAndroid Build Coastguard Worker }
1009*4bdc9457SAndroid Build Coastguard Worker }
1010*4bdc9457SAndroid Build Coastguard Worker }
1011*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,unit_batch_large_width_with_qmax)1012*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, unit_batch_large_width_with_qmax) {
1013*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1014*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1015*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1016*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
1017*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1018*4bdc9457SAndroid Build Coastguard Worker .batch_size(1)
1019*4bdc9457SAndroid Build Coastguard Worker .width(width)
1020*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1021*4bdc9457SAndroid Build Coastguard Worker .qmax(128)
1022*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1023*4bdc9457SAndroid Build Coastguard Worker }
1024*4bdc9457SAndroid Build Coastguard Worker }
1025*4bdc9457SAndroid Build Coastguard Worker }
1026*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,small_batch_small_width)1027*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, small_batch_small_width) {
1028*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1029*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1030*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1031*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
1032*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1033*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
1034*4bdc9457SAndroid Build Coastguard Worker .width(width)
1035*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1036*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1037*4bdc9457SAndroid Build Coastguard Worker }
1038*4bdc9457SAndroid Build Coastguard Worker }
1039*4bdc9457SAndroid Build Coastguard Worker }
1040*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,small_batch_small_width_with_input_stride)1041*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, small_batch_small_width_with_input_stride) {
1042*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1043*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1044*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1045*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
1046*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1047*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
1048*4bdc9457SAndroid Build Coastguard Worker .width(width)
1049*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1050*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
1051*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1052*4bdc9457SAndroid Build Coastguard Worker }
1053*4bdc9457SAndroid Build Coastguard Worker }
1054*4bdc9457SAndroid Build Coastguard Worker }
1055*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,small_batch_small_width_with_output_stride)1056*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, small_batch_small_width_with_output_stride) {
1057*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1058*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1059*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1060*4bdc9457SAndroid Build Coastguard Worker for (size_t width = 1; width <= spatial_tile; width++) {
1061*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1062*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
1063*4bdc9457SAndroid Build Coastguard Worker .width(width)
1064*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1065*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
1066*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1067*4bdc9457SAndroid Build Coastguard Worker }
1068*4bdc9457SAndroid Build Coastguard Worker }
1069*4bdc9457SAndroid Build Coastguard Worker }
1070*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,small_batch_large_width)1071*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, small_batch_large_width) {
1072*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1073*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1074*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1075*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
1076*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1077*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
1078*4bdc9457SAndroid Build Coastguard Worker .width(width)
1079*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1080*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1081*4bdc9457SAndroid Build Coastguard Worker }
1082*4bdc9457SAndroid Build Coastguard Worker }
1083*4bdc9457SAndroid Build Coastguard Worker }
1084*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,small_batch_large_width_with_input_stride)1085*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, small_batch_large_width_with_input_stride) {
1086*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1087*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1088*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1089*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
1090*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1091*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
1092*4bdc9457SAndroid Build Coastguard Worker .width(width)
1093*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1094*4bdc9457SAndroid Build Coastguard Worker .input_stride(5 * channels)
1095*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1096*4bdc9457SAndroid Build Coastguard Worker }
1097*4bdc9457SAndroid Build Coastguard Worker }
1098*4bdc9457SAndroid Build Coastguard Worker }
1099*4bdc9457SAndroid Build Coastguard Worker
TEST(GLOBAL_AVERAGE_POOLING_NWC_F32,small_batch_large_width_with_output_stride)1100*4bdc9457SAndroid Build Coastguard Worker TEST(GLOBAL_AVERAGE_POOLING_NWC_F32, small_batch_large_width_with_output_stride) {
1101*4bdc9457SAndroid Build Coastguard Worker ASSERT_EQ(xnn_status_success, xnn_initialize(nullptr /* allocator */));
1102*4bdc9457SAndroid Build Coastguard Worker const uint32_t spatial_tile = std::max<uint32_t>(xnn_params.f32.gavgpool.row_tile, 1);
1103*4bdc9457SAndroid Build Coastguard Worker for (size_t channels = 1; channels <= 100; channels += 15) {
1104*4bdc9457SAndroid Build Coastguard Worker for (size_t width = spatial_tile; width <= 4 * spatial_tile; width++) {
1105*4bdc9457SAndroid Build Coastguard Worker GlobalAveragePoolingOperatorTester()
1106*4bdc9457SAndroid Build Coastguard Worker .batch_size(3)
1107*4bdc9457SAndroid Build Coastguard Worker .width(width)
1108*4bdc9457SAndroid Build Coastguard Worker .channels(channels)
1109*4bdc9457SAndroid Build Coastguard Worker .output_stride(5 * channels)
1110*4bdc9457SAndroid Build Coastguard Worker .TestNWCxF32();
1111*4bdc9457SAndroid Build Coastguard Worker }
1112*4bdc9457SAndroid Build Coastguard Worker }
1113*4bdc9457SAndroid Build Coastguard Worker }
1114