48 const tflite::RuntimeShape &input_shape,
const int8_t *input_data,
49 const tflite::RuntimeShape &
output_shape, int8_t *output_data,
50 const tflite::RuntimeShape &scratchpad_shape,
51 int8_t *scratchpad_data)
53 assert(input_shape.DimensionsCount() == 4);
55 assert(scratchpad_data !=
nullptr);
57 const int32_t batches = tflite::MatchingDim(input_shape, 0,
output_shape, 0);
60 const int depth = tflite::MatchingDim(input_shape, 3,
output_shape, 3);
62 cmsis_nn_dims input_dims;
64 input_dims.h = input_shape.Dims(1);
65 input_dims.w = input_shape.Dims(2);
68 cmsis_nn_dims output_dims;
72 output_dims.c = depth;
74 cmsis_nn_pool_params pool_params;
75 pool_params.stride.h = params.stride_height;
76 pool_params.stride.w = params.stride_width;
77 pool_params.padding.h = params.padding_values.height;
78 pool_params.padding.w = params.padding_values.width;
79 pool_params.activation.min = params.quantized_activation_min;
80 pool_params.activation.max = params.quantized_activation_max;
82 cmsis_nn_dims filter_dims;
84 filter_dims.h = params.filter_height;
85 filter_dims.w = params.filter_width;
89 ctx.buf = scratchpad_data;
90 ctx.size = scratchpad_shape.Dims(0);
91 auto res = arm_avgpool_s8(&ctx, &pool_params, &input_dims, input_data, &filter_dims, &output_dims,
93 assert(res == ARM_MATH_SUCCESS);
void AveragePool< int8_t >(const tflite::PoolParams ¶ms, const tflite::RuntimeShape &input_shape, const int8_t *input_data, const tflite::RuntimeShape &output_shape, int8_t *output_data, const tflite::RuntimeShape &scratchpad_shape, int8_t *scratchpad_data)