message: Add test function for uint8 MaxPooling.
diff: @@ -235,6 +235,77 @@ void TestMaxPoolFloat(std::initializer_list<int> input_dims_data,
  }
  }
  +void TestMaxPoolQuantizedUInt8(
  + std::initializer_list<int> input_dims_data,
  + std::initializer_list<uint8_t> input_data, float input_min, float input_max,
  + int filter_width, int filter_height, int stride_width, int stride_height,
  + std::initializer_list<uint8_t> expected_output_data, float output_min,
  + float output_max, std::initializer_list<int> output_dims_data,
  + TfLitePadding padding, TfLiteFusedActivation activation,
  + uint8_t* output_data) {
  + TfLiteIntArray* input_dims = IntArrayFromInitializer(input_dims_data);
  + TfLiteIntArray* output_dims = IntArrayFromInitializer(output_dims_data);
  + const int output_dims_count = ElementCount(*output_dims);
  +
  + constexpr int inputs_size = 1;
  + constexpr int outputs_size = 1;
  + constexpr int tensors_size = inputs_size + outputs_size;
  + TfLiteTensor tensors[tensors_size] = {
  + CreateQuantizedTensor(input_data, input_dims, "input_tensor", input_min,
  + input_max),
  + CreateQuantizedTensor(output_data, output_dims, "output_tensor",
  + output_min, output_max),
  + };
  +
  + TfLiteContext context;
  + PopulateContext(tensors, tensors_size, &context);
  +
  + ::tflite::ops::micro::AllOpsResolver resolver;
  + const TfLiteRegistration* registration =
  + resolver.FindOp(tflite::BuiltinOperator_MAX_POOL_2D, 1);
  + TF_LITE_MICRO_EXPECT_NE(nullptr, registration);
  +
  + TfLitePoolParams builtin_data = {
  + padding, stride_width, stride_height,
  + filter_width, filter_height, activation,
  + };
  +
  + const char* init_data = reinterpret_cast<const char*>(&builtin_data);
  + size_t init_data_size = 0;
  + void* user_data = nullptr;
  + if (registration->init) {
  + user_data = registration->init(&context, init_data, init_data_size);
  + }
  +
  + int inputs_array_data[] = {1, 0};
  + TfLiteIntArray* inputs_array = IntArrayFromInts(inputs_array_data);
  + int outputs_array_data[] = {1, 1};
  + TfLiteIntArray* outputs_array = IntArrayFromInts(outputs_array_data);
  + int temporaries_array_data[] = {0};
  + TfLiteIntArray* temporaries_array = IntArrayFromInts(temporaries_array_data);
  +
  + TfLiteNode node;
  + node.inputs = inputs_array;
  + node.outputs = outputs_array;
  + node.temporaries = temporaries_array;
  + node.user_data = user_data;
  + node.builtin_data = reinterpret_cast<void*>(&builtin_data);
  + node.custom_initial_data = nullptr;
  + node.custom_initial_data_size = 0;
  + node.delegate = nullptr;
  + if (registration->prepare) {
  + TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, registration->prepare(&context, &node));
  + }
  + TF_LITE_MICRO_EXPECT_NE(nullptr, registration->invoke);
  + TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, registration->invoke(&context, &node));
  + if (registration->free) {
  + registration->free(&context, user_data);
  + }
  + for (int i = 0; i < output_dims_count; ++i) {
  + TF_LITE_MICRO_EXPECT_EQ(expected_output_data.begin()[i], output_data[i]);
  + }
  +}
  +
  } // namespace
  } // namespace testing
  