31 const int batches = input_shape.
dims(0);
33 const int input_height = input_shape.
dims(1);
34 const int input_width = input_shape.
dims(2);
39 for (
int batch = 0; batch < batches; ++batch)
41 for (
int out_y = 0; out_y < output_height; ++out_y)
43 for (
int out_x = 0; out_x < output_width; ++out_x)
45 for (
int channel = 0; channel < depth; ++channel)
51 const int filter_x_start = std::max(0, -in_x_origin);
52 const int filter_x_end = std::min(params.
filter_width, input_width - in_x_origin);
53 const int filter_y_start = std::max(0, -in_y_origin);
54 const int filter_y_end = std::min(params.
filter_height, input_height - in_y_origin);
55 float max = std::numeric_limits<float>::lowest();
56 for (
int filter_y = filter_y_start; filter_y < filter_y_end; ++filter_y)
58 for (
int filter_x = filter_x_start; filter_x < filter_x_end; ++filter_x)
60 const int in_x = in_x_origin + filter_x;
61 const int in_y = in_y_origin + filter_y;
63 const int input_data_offset =
64 ((batch * input_shape.
dims(1) + in_y) * input_shape.
dims(2) + in_x) *
68 max = std::max(max, input_data[input_data_offset]);
71 const int output_data_offset =
76 output_data[output_data_offset] =
void MaxPool(const PoolParams ¶ms, const luci_interpreter::RuntimeShape &input_shape, const uint8_t *input_data, const luci_interpreter::RuntimeShape &output_shape, uint8_t *output_data, luci_interpreter::DataType data_type)