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 sum_squares = 0.f;
57 for (
int filter_y = filter_y_start; filter_y < filter_y_end; ++filter_y)
59 for (
int filter_x = filter_x_start; filter_x < filter_x_end; ++filter_x)
61 const int in_x = in_x_origin + filter_x;
62 const int in_y = in_y_origin + filter_y;
64 input_data[
offset(input_shape.
dimsData(), batch, in_y, in_x, channel)];
65 sum_squares += val * val;
69 assert(filter_count != 0);
70 const float l2pool_result = std::sqrt(sum_squares / filter_count);
void L2Pool(const PoolParams ¶ms, const luci_interpreter::RuntimeShape &input_shape, const float *input_data, const luci_interpreter::RuntimeShape &output_shape, float *output_data)