1 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #include <cstdint>
17 
18 #include "tensorflow/lite/c/builtin_op_data.h"
19 #include "tensorflow/lite/c/common.h"
20 #include "tensorflow/lite/micro/kernels/kernel_runner.h"
21 #include "tensorflow/lite/micro/test_helpers.h"
22 #include "tensorflow/lite/micro/testing/micro_test.h"
23 
24 namespace tflite {
25 namespace testing {
26 namespace {
27 
28 template <typename T>
ValidatePoolingGoldens(TfLiteTensor * tensors,int tensors_size,const TfLiteRegistration registration,const int filter_height,const int filter_width,const int stride_height,const int stride_width,const T * golden,const int output_length,TfLitePadding padding,TfLiteFusedActivation activation,T * output_data)29 void ValidatePoolingGoldens(TfLiteTensor* tensors, int tensors_size,
30                             const TfLiteRegistration registration,
31                             const int filter_height, const int filter_width,
32                             const int stride_height, const int stride_width,
33                             const T* golden, const int output_length,
34                             TfLitePadding padding,
35                             TfLiteFusedActivation activation, T* output_data) {
36   int inputs_array_data[] = {1, 0};
37   TfLiteIntArray* inputs_array = IntArrayFromInts(inputs_array_data);
38   int outputs_array_data[] = {1, 1};
39   TfLiteIntArray* outputs_array = IntArrayFromInts(outputs_array_data);
40 
41   TfLitePoolParams builtin_data = {padding,
42                                    stride_width,
43                                    stride_height,
44                                    filter_width,
45                                    filter_height,
46                                    activation,
47                                    {}};
48 
49   micro::KernelRunner runner(registration, tensors, tensors_size, inputs_array,
50                              outputs_array,
51                              reinterpret_cast<void*>(&builtin_data));
52 
53   TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, runner.InitAndPrepare());
54   TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, runner.Invoke());
55 
56   for (int i = 0; i < output_length; ++i) {
57     TF_LITE_MICRO_EXPECT_NEAR(golden[i], output_data[i], 1e-5f);
58   }
59 }
60 
TestAveragePoolFloat(int * input_dims_data,const float * input_data,const int filter_height,const int filter_width,const int stride_height,const int stride_width,const float * expected_output_data,int * output_dims_data,TfLitePadding padding,TfLiteFusedActivation activation,float * output_data)61 void TestAveragePoolFloat(int* input_dims_data, const float* input_data,
62                           const int filter_height, const int filter_width,
63                           const int stride_height, const int stride_width,
64                           const float* expected_output_data,
65                           int* output_dims_data, TfLitePadding padding,
66                           TfLiteFusedActivation activation,
67                           float* output_data) {
68   TfLiteIntArray* input_dims = IntArrayFromInts(input_dims_data);
69   TfLiteIntArray* output_dims = IntArrayFromInts(output_dims_data);
70   const int output_dims_count = ElementCount(*output_dims);
71 
72   constexpr int inputs_size = 1;
73   constexpr int outputs_size = 1;
74   constexpr int tensors_size = inputs_size + outputs_size;
75   TfLiteTensor tensors[tensors_size] = {
76       CreateTensor(input_data, input_dims),
77       CreateTensor(output_data, output_dims),
78   };
79 
80   const TfLiteRegistration registration = Register_AVERAGE_POOL_2D();
81 
82   ValidatePoolingGoldens(tensors, tensors_size, registration, filter_height,
83                          filter_width, stride_height, stride_width,
84                          expected_output_data, output_dims_count, padding,
85                          activation, output_data);
86 }
87 
88 template <typename T>
TestAveragePoolQuantized(int * input_dims_data,const T * input_data,const float input_scale,const int input_zero_point,const int filter_height,const int filter_width,const int stride_height,const int stride_width,const T * expected_output_data,int * output_dims_data,const float output_scale,const int output_zero_point,TfLitePadding padding,TfLiteFusedActivation activation,T * output_data)89 void TestAveragePoolQuantized(
90     int* input_dims_data, const T* input_data, const float input_scale,
91     const int input_zero_point, const int filter_height, const int filter_width,
92     const int stride_height, const int stride_width,
93     const T* expected_output_data, int* output_dims_data,
94     const float output_scale, const int output_zero_point,
95     TfLitePadding padding, TfLiteFusedActivation activation, T* output_data) {
96   static_assert(sizeof(T) == 1, "Only int8_t/uint8_t data types allowed.");
97 
98   TfLiteIntArray* input_dims = IntArrayFromInts(input_dims_data);
99   TfLiteIntArray* output_dims = IntArrayFromInts(output_dims_data);
100   const int output_dims_count = ElementCount(*output_dims);
101 
102   constexpr int inputs_size = 1;
103   constexpr int outputs_size = 1;
104   constexpr int tensors_size = inputs_size + outputs_size;
105   TfLiteTensor tensors[tensors_size] = {
106       CreateQuantizedTensor(input_data, input_dims, input_scale,
107                             input_zero_point),
108       CreateQuantizedTensor(output_data, output_dims, output_scale,
109                             output_zero_point),
110   };
111 
112   const TfLiteRegistration registration = Register_AVERAGE_POOL_2D();
113   ValidatePoolingGoldens(tensors, tensors_size, registration, filter_height,
114                          filter_width, stride_height, stride_width,
115                          expected_output_data, output_dims_count, padding,
116                          activation, output_data);
117 }
118 
TestMaxPoolFloat(int * input_dims_data,const float * input_data,int filter_width,int filter_height,int stride_width,int stride_height,const float * expected_output_data,int * output_dims_data,TfLitePadding padding,TfLiteFusedActivation activation,float * output_data)119 void TestMaxPoolFloat(int* input_dims_data, const float* input_data,
120                       int filter_width, int filter_height, int stride_width,
121                       int stride_height, const float* expected_output_data,
122                       int* output_dims_data, TfLitePadding padding,
123                       TfLiteFusedActivation activation, float* output_data) {
124   TfLiteIntArray* input_dims = IntArrayFromInts(input_dims_data);
125   TfLiteIntArray* output_dims = IntArrayFromInts(output_dims_data);
126   const int output_dims_count = ElementCount(*output_dims);
127 
128   constexpr int inputs_size = 1;
129   constexpr int outputs_size = 1;
130   constexpr int tensors_size = inputs_size + outputs_size;
131   TfLiteTensor tensors[tensors_size] = {
132       CreateTensor(input_data, input_dims),
133       CreateTensor(output_data, output_dims),
134   };
135 
136   const TfLiteRegistration registration = Register_MAX_POOL_2D();
137   ValidatePoolingGoldens(tensors, tensors_size, registration, filter_height,
138                          filter_width, stride_height, stride_width,
139                          expected_output_data, output_dims_count, padding,
140                          activation, output_data);
141 }
142 
143 template <typename T>
TestMaxPoolQuantized(int * input_dims_data,const T * input_data,const float input_scale,const int input_zero_point,const int filter_height,const int filter_width,const int stride_height,const int stride_width,const T * expected_output_data,int * output_dims_data,const float output_scale,const int output_zero_point,TfLitePadding padding,TfLiteFusedActivation activation,T * output_data)144 void TestMaxPoolQuantized(int* input_dims_data, const T* input_data,
145                           const float input_scale, const int input_zero_point,
146                           const int filter_height, const int filter_width,
147                           const int stride_height, const int stride_width,
148                           const T* expected_output_data, int* output_dims_data,
149                           const float output_scale, const int output_zero_point,
150                           TfLitePadding padding,
151                           TfLiteFusedActivation activation, T* output_data) {
152   TfLiteIntArray* input_dims = IntArrayFromInts(input_dims_data);
153   TfLiteIntArray* output_dims = IntArrayFromInts(output_dims_data);
154   const int output_dims_count = ElementCount(*output_dims);
155 
156   constexpr int inputs_size = 1;
157   constexpr int outputs_size = 1;
158   constexpr int tensors_size = inputs_size + outputs_size;
159   TfLiteTensor tensors[tensors_size] = {
160       CreateQuantizedTensor(input_data, input_dims, input_scale,
161                             input_zero_point),
162       CreateQuantizedTensor(output_data, output_dims, output_scale,
163                             output_zero_point),
164   };
165 
166   const TfLiteRegistration registration = Register_MAX_POOL_2D();
167   ValidatePoolingGoldens(tensors, tensors_size, registration, filter_height,
168                          filter_width, stride_height, stride_width,
169                          expected_output_data, output_dims_count, padding,
170                          activation, output_data);
171 }
172 
173 }  // namespace
174 
175 }  // namespace testing
176 }  // namespace tflite
177 
178 TF_LITE_MICRO_TESTS_BEGIN
179 
TF_LITE_MICRO_TEST(SimpleAveragePoolTestFloat)180 TF_LITE_MICRO_TEST(SimpleAveragePoolTestFloat) {
181   int input_shape[] = {4, 1, 2, 4, 1};
182   const float input_values[] = {0, 6, 2, 4, 3, 2, 10, 7};
183   const int filter_width = 2;
184   const int filter_height = 2;
185   const int stride_width = 2;
186   const int stride_height = 2;
187   const float golden[] = {2.75, 5.75};
188   int output_shape[] = {4, 1, 1, 2, 1};
189   float output_data[2];
190   tflite::testing::TestAveragePoolFloat(
191       input_shape, input_values, filter_height, filter_width, stride_height,
192       stride_width, golden, output_shape, kTfLitePaddingValid, kTfLiteActNone,
193       output_data);
194 }
195 
TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride2ActNone)196 TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride2ActNone) {
197   int input_shape[] = {4, 1, 2, 4, 1};
198   const int8_t input_values[] = {0, -24, 8, 16, 12, 8, -40, 28};
199   const int filter_width = 2;
200   const int filter_height = 2;
201   const int stride_width = 2;
202   const int stride_height = 2;
203   const int8_t golden[] = {-1, 3};
204   int output_shape[] = {4, 1, 1, 2, 1};
205   int8_t output_data[2];
206 
207   const float input_scale = .25;
208   const int input_zero_point = 0;
209   const float output_scale = .25;
210   const int output_zero_point = 0;
211   tflite::testing::TestAveragePoolQuantized(
212       input_shape, input_values, input_scale, input_zero_point, filter_height,
213       filter_width, stride_height, stride_width, golden, output_shape,
214       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActNone,
215       output_data);
216 }
217 
TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride1Stride2Relu)218 TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride1Stride2Relu) {
219   int input_shape[] = {4, 1, 2, 4, 1};
220   const int8_t input_values[] = {0, -24, 8, 16, 12, 8, -40, 28};
221   const int filter_width = 2;
222   const int filter_height = 2;
223   const int stride_width = 1;
224   const int stride_height = 2;
225   const int8_t golden[] = {0, 0, 3};
226   int output_shape[] = {4, 1, 1, 3, 1};
227   int8_t output_data[3];
228 
229   const float input_scale = .25;
230   const int input_zero_point = 0;
231   const float output_scale = .25;
232   const int output_zero_point = 0;
233   tflite::testing::TestAveragePoolQuantized(
234       input_shape, input_values, input_scale, input_zero_point, filter_height,
235       filter_width, stride_height, stride_width, golden, output_shape,
236       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActRelu,
237       output_data);
238 }
239 
TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride2Stride1ReluN1To1)240 TF_LITE_MICRO_TEST(
241     SimpleAveragePoolTestInt8PaddingValidStride2Stride1ReluN1To1) {
242   int input_shape[] = {4, 1, 2, 4, 1};
243   const int8_t input_values[] = {0, -24, 8, 16, 12, 8, -40, 28};
244   const int filter_width = 2;
245   const int filter_height = 2;
246   const int stride_width = 2;
247   const int stride_height = 1;
248   const int8_t golden[] = {-1, 3};
249   int output_shape[] = {4, 1, 1, 2, 1};
250   int8_t output_data[2];
251 
252   const float input_scale = .25;
253   const int input_zero_point = 0;
254   const float output_scale = .25;
255   const int output_zero_point = 0;
256   tflite::testing::TestAveragePoolQuantized(
257       input_shape, input_values, input_scale, input_zero_point, filter_height,
258       filter_width, stride_height, stride_width, golden, output_shape,
259       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActReluN1To1,
260       output_data);
261 }
262 
TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride2Relu6)263 TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingValidStride2Relu6) {
264   int input_shape[] = {4, 1, 2, 4, 1};
265   const int8_t input_values[] = {12, -24, 32, 16, 12, 8, 40, 28};
266   const int filter_width = 2;
267   const int filter_height = 2;
268   const int stride_width = 2;
269   const int stride_height = 2;
270   const int8_t golden[] = {2, 24};
271   int output_shape[] = {4, 1, 1, 2, 1};
272   int8_t output_data[2];
273 
274   const float input_scale = .25;
275   const int input_zero_point = 0;
276   const float output_scale = .25;
277   const int output_zero_point = 0;
278   tflite::testing::TestAveragePoolQuantized(
279       input_shape, input_values, input_scale, input_zero_point, filter_height,
280       filter_width, stride_height, stride_width, golden, output_shape,
281       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActRelu6,
282       output_data);
283 }
284 
TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingSameStride1ActNone)285 TF_LITE_MICRO_TEST(SimpleAveragePoolTestInt8PaddingSameStride1ActNone) {
286   int input_shape[] = {4, 1, 2, 4, 1};
287   const int8_t input_values[] = {12, -24, 32, 16, 12, 8, 40, 28};
288   const int filter_width = 2;
289   const int filter_height = 2;
290   const int stride_width = 1;
291   const int stride_height = 1;
292   const int8_t golden[] = {2, 14, 29, 22, 10, 24, 34, 28};
293   int output_shape[] = {4, 1, 2, 4, 1};
294   int8_t output_data[8];
295 
296   const float input_scale = .25;
297   const int input_zero_point = 0;
298   const float output_scale = .25;
299   const int output_zero_point = 0;
300   tflite::testing::TestAveragePoolQuantized(
301       input_shape, input_values, input_scale, input_zero_point, filter_height,
302       filter_width, stride_height, stride_width, golden, output_shape,
303       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActNone,
304       output_data);
305 }
306 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloat)307 TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloat) {
308   int input_shape[] = {4, 1, 2, 4, 1};
309   const float input_values[] = {0, 6, 2, 4, 3, 2, 10, 7};
310   const int filter_width = 2;
311   const int filter_height = 2;
312   const int stride_width = 2;
313   const int stride_height = 2;
314   const float golden[] = {6, 10};
315   int output_shape[] = {4, 1, 1, 2, 1};
316   float output_data[2];
317   tflite::testing::TestMaxPoolFloat(input_shape, input_values, filter_height,
318                                     filter_width, stride_height, stride_width,
319                                     golden, output_shape, kTfLitePaddingValid,
320                                     kTfLiteActNone, output_data);
321 }
322 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloatRelu)323 TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloatRelu) {
324   int input_shape[] = {4, 1, 2, 4, 1};
325   const float input_values[] = {-1, -6, 2, 4, -3, -2, 10.5, 7};
326   const int filter_width = 2;
327   const int filter_height = 2;
328   const int stride_width = 2;
329   const int stride_height = 2;
330   const float golden[] = {0, 10.5};
331   int output_shape[] = {4, 1, 1, 2, 1};
332   float output_data[2];
333   tflite::testing::TestMaxPoolFloat(input_shape, input_values, filter_height,
334                                     filter_width, stride_height, stride_width,
335                                     golden, output_shape, kTfLitePaddingValid,
336                                     kTfLiteActRelu, output_data);
337 }
338 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloatReluN1To1)339 TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloatReluN1To1) {
340   int input_shape[] = {4, 1, 2, 4, 1};
341   const float input_values1[] = {-2.75, -6, 0.2, 0.4, -3, -2, -0.3, 0.7};
342   const int filter_width = 2;
343   const int filter_height = 2;
344   const int stride_width = 2;
345   const int stride_height = 2;
346   const float golden1[] = {-1.0, 0.7};
347   int output_shape[] = {4, 1, 1, 2, 1};
348   float output_data[2];
349   tflite::testing::TestMaxPoolFloat(input_shape, input_values1, filter_height,
350                                     filter_width, stride_height, stride_width,
351                                     golden1, output_shape, kTfLitePaddingValid,
352                                     kTfLiteActReluN1To1, output_data);
353 
354   const float input_values2[] = {-2.75, -6, -2, -4, -3, -2, 10, -7};
355   const float golden2[] = {-1.0, 1.0};
356   tflite::testing::TestMaxPoolFloat(input_shape, input_values2, filter_height,
357                                     filter_width, stride_height, stride_width,
358                                     golden2, output_shape, kTfLitePaddingValid,
359                                     kTfLiteActReluN1To1, output_data);
360 }
361 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloatRelu6)362 TF_LITE_MICRO_TEST(SimpleMaxPoolTestFloatRelu6) {
363   int input_shape[] = {4, 1, 2, 4, 1};
364   const float input_values1[] = {-1.5, -6, 12, 4, -3, -2, 10, 7};
365   const int filter_width = 2;
366   const int filter_height = 2;
367   const int stride_width = 2;
368   const int stride_height = 2;
369   const float golden1[] = {0, 6};
370   int output_shape[] = {4, 1, 1, 2, 1};
371   float output_data[2];
372   tflite::testing::TestMaxPoolFloat(input_shape, input_values1, filter_height,
373                                     filter_width, stride_height, stride_width,
374                                     golden1, output_shape, kTfLitePaddingValid,
375                                     kTfLiteActRelu6, output_data);
376 
377   const float input_values2[] = {0, 4.5, 12, 4, 3, 2, 10, 7};
378   const float golden2[] = {4.5, 6};
379   tflite::testing::TestMaxPoolFloat(input_shape, input_values2, filter_height,
380                                     filter_width, stride_height, stride_width,
381                                     golden2, output_shape, kTfLitePaddingValid,
382                                     kTfLiteActRelu6, output_data);
383 }
384 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestPaddingSameStride1)385 TF_LITE_MICRO_TEST(SimpleMaxPoolTestPaddingSameStride1) {
386   int input_shape[] = {4, 1, 2, 4, 1};
387   const float input_values[] = {0, 6, 2, 4, 3, 2, 10, 7};
388   const int filter_width = 2;
389   const int filter_height = 2;
390   const int stride_width = 1;
391   const int stride_height = 1;
392   const float golden[] = {6, 10, 10, 7, 3, 10, 10, 7};
393   int output_shape[] = {4, 1, 2, 4, 1};
394   float output_data[8];
395   tflite::testing::TestMaxPoolFloat(input_shape, input_values, filter_height,
396                                     filter_width, stride_height, stride_width,
397                                     golden, output_shape, kTfLitePaddingSame,
398                                     kTfLiteActNone, output_data);
399 }
400 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestPaddingValidStride1)401 TF_LITE_MICRO_TEST(SimpleMaxPoolTestPaddingValidStride1) {
402   int input_shape[] = {4, 1, 2, 4, 1};
403   const float input_values[] = {0, 6, 2, 4, 3, 2, 10, 7};
404   const int filter_width = 2;
405   const int filter_height = 2;
406   const int stride_width = 1;
407   const int stride_height = 1;
408   const float golden[] = {6, 10, 10};
409   int output_shape[] = {4, 1, 1, 3, 1};
410   float output_data[8];
411   tflite::testing::TestMaxPoolFloat(input_shape, input_values, filter_height,
412                                     filter_width, stride_height, stride_width,
413                                     golden, output_shape, kTfLitePaddingValid,
414                                     kTfLiteActNone, output_data);
415 }
416 
TF_LITE_MICRO_TEST(SimpleMaxPoolTestInt8ActNone)417 TF_LITE_MICRO_TEST(SimpleMaxPoolTestInt8ActNone) {
418   int input_shape[] = {4, 1, 2, 4, 1};
419   const int8_t input_values1[] = {0, 6, 2, 4, 3, 2, 10, 7};
420   const int filter_width = 2;
421   const int filter_height = 2;
422   const int stride_width = 2;
423   const int stride_height = 2;
424   const int8_t golden1[] = {6, 10};
425   int output_shape[] = {4, 1, 1, 2, 1};
426   int8_t output_data[2];
427 
428   const float input_scale = 1.0;
429   const int input_zero_point = 0;
430   const float output_scale = 1.0;
431   const int output_zero_point = 0;
432   tflite::testing::TestMaxPoolQuantized(
433       input_shape, input_values1, input_scale, input_zero_point, filter_height,
434       filter_width, stride_height, stride_width, golden1, output_shape,
435       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActNone,
436       output_data);
437 }
438 
TF_LITE_MICRO_TEST(MaxPoolTestInt8ActRelu)439 TF_LITE_MICRO_TEST(MaxPoolTestInt8ActRelu) {
440   int input_shape[] = {4, 1, 2, 4, 1};
441   const int8_t input_values1[] = {-3, -12, 4, 8, -6, -4, 20, 14};
442   const int filter_width = 2;
443   const int filter_height = 2;
444   const int stride_width = 2;
445   const int stride_height = 2;
446   const int8_t golden1[] = {0, 20};
447   int output_shape[] = {4, 1, 1, 2, 1};
448   int8_t output_data[2];
449 
450   const float input_scale = 0.5;
451   const int input_zero_point = 0;
452   const float output_scale = 0.5;
453   const int output_zero_point = 0;
454   tflite::testing::TestMaxPoolQuantized(
455       input_shape, input_values1, input_scale, input_zero_point, filter_height,
456       filter_width, stride_height, stride_width, golden1, output_shape,
457       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActRelu,
458       output_data);
459 }
460 
TF_LITE_MICRO_TEST(MaxPoolTestInt8ActReluN1To1)461 TF_LITE_MICRO_TEST(MaxPoolTestInt8ActReluN1To1) {
462   int input_shape[] = {4, 1, 2, 4, 1};
463   const int8_t input_values1[] = {-2, -6, -2, -4, -3, -2, 10, 7};
464   const int filter_width = 2;
465   const int filter_height = 2;
466   const int stride_width = 2;
467   const int stride_height = 2;
468   const int8_t golden1[] = {-1, 1};
469   int output_shape[] = {4, 1, 1, 2, 1};
470   int8_t output_data[2];
471 
472   const float input_scale = 1.0;
473   const int input_zero_point = 0;
474   const float output_scale = 1.0;
475   const int output_zero_point = 0;
476   tflite::testing::TestMaxPoolQuantized(
477       input_shape, input_values1, input_scale, input_zero_point, filter_height,
478       filter_width, stride_height, stride_width, golden1, output_shape,
479       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActReluN1To1,
480       output_data);
481 }
482 
TF_LITE_MICRO_TEST(MaxPoolTestInt8ActRelu6)483 TF_LITE_MICRO_TEST(MaxPoolTestInt8ActRelu6) {
484   int input_shape[] = {4, 1, 2, 4, 1};
485   const int8_t input_values1[] = {0, -6, 12, 4, -3, -2, 10, 7};
486   const int filter_width = 2;
487   const int filter_height = 2;
488   const int stride_width = 2;
489   const int stride_height = 2;
490   const int8_t golden1[] = {0, 6};
491   int output_shape[] = {4, 1, 1, 2, 1};
492   int8_t output_data[2];
493 
494   const float input_scale = 1.0;
495   const int input_zero_point = 0;
496   const float output_scale = 1.0;
497   const int output_zero_point = 0;
498   tflite::testing::TestMaxPoolQuantized(
499       input_shape, input_values1, input_scale, input_zero_point, filter_height,
500       filter_width, stride_height, stride_width, golden1, output_shape,
501       output_scale, output_zero_point, kTfLitePaddingValid, kTfLiteActRelu6,
502       output_data);
503 }
504 
505 TF_LITE_MICRO_TESTS_END
506