28 const uint8_t *input_data,
32 cmsis_nn_dims input_dims;
33 cmsis_nn_dims output_dims;
34 cmsis_nn_pool_params pool_params;
35 cmsis_nn_dims filter_dims;
38 const int depth = input_shape.
dims(3);
42 input_dims.h = input_shape.
dims(1);
43 input_dims.w = input_shape.
dims(2);
48 output_dims.w = output_width;
49 output_dims.c = depth;
63 const int32_t buffer_size = data_type == luci_interpreter::DataType::S16
64 ? arm_avgpool_s16_get_buffer_size(output_width, depth)
65 : arm_avgpool_s8_get_buffer_size(output_width, depth);
66 int8_t *buffer =
nullptr;
69 buffer =
new int8_t[buffer_size];
73 ctx.size = buffer_size;
75 if (data_type == luci_interpreter::DataType::S8)
77 arm_avgpool_s8(&ctx, &pool_params, &input_dims,
78 luci_interpreter::kernels::getTensorData<int8_t>(input_data), &filter_dims,
79 &output_dims, luci_interpreter::kernels::getTensorData<int8_t>(output_data));
83 arm_avgpool_s16(&ctx, &pool_params, &input_dims,
84 luci_interpreter::kernels::getTensorData<int16_t>(input_data), &filter_dims,
85 &output_dims, luci_interpreter::kernels::getTensorData<int16_t>(output_data));