CMSIS-NN  Version 4.0.0
CMSIS NN Software Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Pooling Functions

Functions

arm_cmsis_nn_status arm_avgpool_s16 (const cmsis_nn_context *ctx, const cmsis_nn_pool_params *pool_params, const cmsis_nn_dims *input_dims, const q15_t *src, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, q15_t *dst)
 s16 average pooling function. More...
 
int32_t arm_avgpool_s16_get_buffer_size (const int output_x, const int ch_src)
 Get the required buffer size for S16 average pooling function. More...
 
arm_cmsis_nn_status arm_avgpool_s8 (const cmsis_nn_context *ctx, const cmsis_nn_pool_params *pool_params, const cmsis_nn_dims *input_dims, const q7_t *src, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, q7_t *dst)
 s8 average pooling function. More...
 
int32_t arm_avgpool_s8_get_buffer_size (const int output_x, const int ch_src)
 Get the required buffer size for S8 average pooling function. More...
 
arm_cmsis_nn_status arm_max_pool_s16 (const cmsis_nn_context *ctx, const cmsis_nn_pool_params *pool_params, const cmsis_nn_dims *input_dims, const int16_t *src, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, int16_t *dst)
 s16 max pooling function. More...
 
arm_cmsis_nn_status arm_max_pool_s8 (const cmsis_nn_context *ctx, const cmsis_nn_pool_params *pool_params, const cmsis_nn_dims *input_dims, const q7_t *src, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, q7_t *dst)
 s8 max pooling function. More...
 
void arm_maxpool_q7_HWC (q7_t *Im_in, const uint16_t dim_im_in, const uint16_t ch_im_in, const uint16_t dim_kernel, const uint16_t padding, const uint16_t stride, const uint16_t dim_im_out, q7_t *bufferA, q7_t *Im_out)
 Q7 max pooling function. More...
 
void arm_avepool_q7_HWC (q7_t *Im_in, const uint16_t dim_im_in, const uint16_t ch_im_in, const uint16_t dim_kernel, const uint16_t padding, const uint16_t stride, const uint16_t dim_im_out, q7_t *bufferA, q7_t *Im_out)
 Q7 average pooling function. More...
 

Description

Perform pooling functions, including max pooling and average pooling

Function Documentation

void arm_avepool_q7_HWC ( q7_t Im_in,
const uint16_t  dim_im_in,
const uint16_t  ch_im_in,
const uint16_t  dim_kernel,
const uint16_t  padding,
const uint16_t  stride,
const uint16_t  dim_im_out,
q7_t bufferA,
q7_t Im_out 
)
Parameters
[in,out]Im_inpointer to input tensor
[in]dim_im_ininput tensor dimention
[in]ch_im_innumber of input tensor channels
[in]dim_kernelfilter kernel size
[in]paddingpadding sizes
[in]strideconvolution stride
[in]dim_im_outoutput tensor dimension
[in,out]bufferApointer to buffer space for input
[in,out]Im_outpointer to output tensor

Buffer size:

bufferA size: 2*dim_im_out*ch_im_in

The pooling function is implemented as split x-pooling then y-pooling.

This pooling function is input-destructive. Input data is undefined after calling this function.

References arm_q7_to_q15_no_shift().

arm_cmsis_nn_status arm_avgpool_s16 ( const cmsis_nn_context ctx,
const cmsis_nn_pool_params pool_params,
const cmsis_nn_dims input_dims,
const int16_t *  input_data,
const cmsis_nn_dims filter_dims,
const cmsis_nn_dims output_dims,
int16_t *  output_data 
)
Parameters
[in,out]ctxFunction context (e.g. temporary buffer). Check the function definition file to see if an additional buffer is required. Optional function {API}_get_buffer_size() provides the buffer size if an additional buffer is required. The caller is expected to clear the buffer ,if applicable, for security reasons.
[in]pool_paramsPooling parameters
[in]input_dimsInput (activation) tensor dimensions. Format: [H, W, C_IN] Argument 'N' is not used.
[in]input_dataInput (activation) data pointer. Data type: int16
[in]filter_dimsFilter tensor dimensions. Format: [H, W] Argument N and C are not used.
[in]output_dimsOutput tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
[in,out]output_dataOutput data pointer. Data type: int16
Returns
The function returns ARM_CMSIS_NN_SUCCESS - Successful operation ARM_CMSIS_NN_ARG_ERROR - In case of invalid arguments
  • Supported Framework: TensorFlow Lite

References cmsis_nn_pool_params::activation, ARM_CMSIS_NN_ARG_ERROR, ARM_CMSIS_NN_SUCCESS, cmsis_nn_context::buf, cmsis_nn_dims::c, cmsis_nn_tile::h, cmsis_nn_dims::h, MAX, cmsis_nn_activation::max, MIN, cmsis_nn_activation::min, cmsis_nn_pool_params::padding, cmsis_nn_pool_params::stride, cmsis_nn_tile::w, and cmsis_nn_dims::w.

int32_t arm_avgpool_s16_get_buffer_size ( const int  dim_dst_width,
const int  ch_src 
)
Parameters
[in]dim_dst_widthoutput tensor dimension
[in]ch_srcnumber of input tensor channels
Returns
The function returns required buffer size in bytes
arm_cmsis_nn_status arm_avgpool_s8 ( const cmsis_nn_context ctx,
const cmsis_nn_pool_params pool_params,
const cmsis_nn_dims input_dims,
const q7_t input_data,
const cmsis_nn_dims filter_dims,
const cmsis_nn_dims output_dims,
q7_t output_data 
)
Parameters
[in,out]ctxFunction context (e.g. temporary buffer). Check the function definition file to see if an additional buffer is required. Optional function {API}_get_buffer_size() provides the buffer size if an additional buffer is required. The caller is expected to clear the buffer ,if applicable, for security reasons.
[in]pool_paramsPooling parameters
[in]input_dimsInput (activation) tensor dimensions. Format: [H, W, C_IN] Argument 'N' is not used.
[in]input_dataInput (activation) data pointer. Data type: int8
[in]filter_dimsFilter tensor dimensions. Format: [H, W] Argument N and C are not used.
[in]output_dimsOutput tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
[in,out]output_dataOutput data pointer. Data type: int8
Returns
The function returns ARM_CMSIS_NN_SUCCESS - Successful operation
  • Supported Framework: TensorFlow Lite

References cmsis_nn_pool_params::activation, arm_avgpool_s8_get_buffer_size(), ARM_CMSIS_NN_ARG_ERROR, ARM_CMSIS_NN_SUCCESS, cmsis_nn_context::buf, cmsis_nn_dims::c, cmsis_nn_tile::h, cmsis_nn_dims::h, MAX, cmsis_nn_activation::max, MIN, cmsis_nn_activation::min, cmsis_nn_pool_params::padding, cmsis_nn_pool_params::stride, cmsis_nn_tile::w, and cmsis_nn_dims::w.

int32_t arm_avgpool_s8_get_buffer_size ( const int  dim_dst_width,
const int  ch_src 
)
Parameters
[in]dim_dst_widthoutput tensor dimension
[in]ch_srcnumber of input tensor channels
Returns
The function returns required buffer size in bytes

Referenced by arm_avgpool_s8().

arm_cmsis_nn_status arm_max_pool_s16 ( const cmsis_nn_context ctx,
const cmsis_nn_pool_params pool_params,
const cmsis_nn_dims input_dims,
const int16_t *  src,
const cmsis_nn_dims filter_dims,
const cmsis_nn_dims output_dims,
int16_t *  dst 
)
Parameters
[in,out]ctxFunction context (e.g. temporary buffer). Check the function definition file to see if an additional buffer is required. Optional function {API}_get_buffer_size() provides the buffer size if an additional buffer is required. The caller is expected to clear the buffer ,if applicable, for security reasons.
[in]pool_paramsPooling parameters
[in]input_dimsInput (activation) tensor dimensions. Format: [H, W, C_IN] Argument 'N' is not used.
[in]srcInput (activation) data pointer. The input tensor must not overlap with the output tensor. Data type: int16
[in]filter_dimsFilter tensor dimensions. Format: [H, W] Argument N and C are not used.
[in]output_dimsOutput tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
[in,out]dstOutput data pointer. Data type: int16
Returns
The function returns ARM_CMSIS_NN_SUCCESS - Successful operation
  • Supported Framework: TensorFlow Lite

References cmsis_nn_pool_params::activation, ARM_CMSIS_NN_SUCCESS, cmsis_nn_dims::c, clamp_output(), compare_and_replace_if_larger(), cmsis_nn_tile::h, cmsis_nn_dims::h, MAX, cmsis_nn_activation::max, MIN, cmsis_nn_activation::min, cmsis_nn_pool_params::padding, cmsis_nn_pool_params::stride, cmsis_nn_tile::w, and cmsis_nn_dims::w.

arm_cmsis_nn_status arm_max_pool_s8 ( const cmsis_nn_context ctx,
const cmsis_nn_pool_params pool_params,
const cmsis_nn_dims input_dims,
const q7_t input_data,
const cmsis_nn_dims filter_dims,
const cmsis_nn_dims output_dims,
q7_t output_data 
)
Parameters
[in,out]ctxFunction context (e.g. temporary buffer). Check the function definition file to see if an additional buffer is required. Optional function {API}_get_buffer_size() provides the buffer size if an additional buffer is required. The caller is expected to clear the buffer ,if applicable, for security reasons.
[in]pool_paramsPooling parameters
[in]input_dimsInput (activation) tensor dimensions. Format: [H, W, C_IN] Argument 'N' is not used.
[in]input_dataInput (activation) data pointer. The input tensor must not overlap with the output tensor. Data type: int8
[in]filter_dimsFilter tensor dimensions. Format: [H, W] Argument N and C are not used.
[in]output_dimsOutput tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
[in,out]output_dataOutput data pointer. Data type: int8
Returns
The function returns ARM_CMSIS_NN_SUCCESS - Successful operation
  • Supported Framework: TensorFlow Lite

References cmsis_nn_pool_params::activation, ARM_CMSIS_NN_SUCCESS, arm_memcpy_q7(), cmsis_nn_dims::c, clamp_output(), compare_and_replace_if_larger_q7(), cmsis_nn_tile::h, cmsis_nn_dims::h, MAX, cmsis_nn_activation::max, MIN, cmsis_nn_activation::min, cmsis_nn_pool_params::padding, cmsis_nn_pool_params::stride, cmsis_nn_tile::w, and cmsis_nn_dims::w.

void arm_maxpool_q7_HWC ( q7_t Im_in,
const uint16_t  dim_im_in,
const uint16_t  ch_im_in,
const uint16_t  dim_kernel,
const uint16_t  padding,
const uint16_t  stride,
const uint16_t  dim_im_out,
q7_t bufferA,
q7_t Im_out 
)
Parameters
[in,out]Im_inpointer to input tensor
[in]dim_im_ininput tensor dimention
[in]ch_im_innumber of input tensor channels
[in]dim_kernelfilter kernel size
[in]paddingpadding sizes
[in]strideconvolution stride
[in]dim_im_outoutput tensor dimension
[in,out]bufferANot used
[in,out]Im_outpointer to output tensor

The pooling function is implemented as split x-pooling then y-pooling.

This pooling function is input-destructive. Input data is undefined after calling this function.

References compare_and_replace_if_larger_q7().