Pooling Functions
-
riscv_nmsis_nn_status riscv_avgpool_s16(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int16_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int16_t *dst)
-
riscv_nmsis_nn_status riscv_avgpool_s8(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int8_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int8_t *dst)
-
riscv_nmsis_nn_status riscv_max_pool_s16(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int16_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int16_t *dst)
-
riscv_nmsis_nn_status riscv_max_pool_s8(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int8_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int8_t *dst)
-
void riscv_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)
-
void riscv_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)
- group Pooling
Perform pooling functions, including max pooling and average pooling.
Perform max and average pooling operations.
Functions
-
riscv_nmsis_nn_status riscv_avgpool_s16(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int16_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int16_t *dst)
s16 average pooling function.
Supported Framework: TensorFlow Lite
- Parameters
ctx – [inout] Function 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.
pool_params – [in] Pooling parameters
input_dims – [in] Input (activation) tensor dimensions. Format: [H, W, C_IN]
input_data – [in] Input (activation) data pointer. Data type: int16
filter_dims – [in] Filter tensor dimensions. Format: [H, W] Argument N and C are not used.
output_dims – [in] Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
output_data – [inout] Output data pointer. Data type: int16
- Returns
The function returns
RISCV_NMSIS_NN_SUCCESS
- Successful operationRISCV_NMSIS_NN_ARG_ERROR
- In case of invalid arguments
-
riscv_nmsis_nn_status riscv_avgpool_s8(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int8_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int8_t *dst)
s8 average pooling function.
Supported Framework: TensorFlow Lite
- Parameters
ctx – [inout] Function 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.
pool_params – [in] Pooling parameters
input_dims – [in] Input (activation) tensor dimensions. Format: [H, W, C_IN]
input_data – [in] Input (activation) data pointer. Data type: int8
filter_dims – [in] Filter tensor dimensions. Format: [H, W] Argument N and C are not used.
output_dims – [in] Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
output_data – [inout] Output data pointer. Data type: int8
- Returns
The function returns either
RISCV_NMSIS_NN_ARG_ERROR
if argument constraints fail. or,RISCV_NMSIS_NN_SUCCESS
on successful completion.
-
riscv_nmsis_nn_status riscv_max_pool_s16(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int16_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int16_t *dst)
s16 max pooling function.
Supported Framework: TensorFlow Lite
- Parameters
ctx – [inout] Function 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.
pool_params – [in] Pooling parameters
input_dims – [in] Input (activation) tensor dimensions. Format: [H, W, C_IN]
src – [in] Input (activation) data pointer. The input tensor must not overlap with the output tensor. Data type: int16
filter_dims – [in] Filter tensor dimensions. Format: [H, W] Argument N and C are not used.
output_dims – [in] Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
dst – [inout] Output data pointer. Data type: int16
- Returns
The function returns either
RISCV_NMSIS_NN_ARG_ERROR
if argument constraints fail. or,RISCV_NMSIS_NN_SUCCESS
on successful completion.
-
riscv_nmsis_nn_status riscv_max_pool_s8(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int8_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int8_t *dst)
s8 max pooling function.
Supported Framework: TensorFlow Lite
- Parameters
ctx – [inout] Function 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.
pool_params – [in] Pooling parameters
input_dims – [in] Input (activation) tensor dimensions. Format: [H, W, C_IN]
input_data – [in] Input (activation) data pointer. The input tensor must not overlap with the output tensor. Data type: int8
filter_dims – [in] Filter tensor dimensions. Format: [H, W] Argument N and C are not used.
output_dims – [in] Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN.
output_data – [inout] Output data pointer. Data type: int8
- Returns
The function returns either
RISCV_NMSIS_NN_ARG_ERROR
if argument constraints fail. or,RISCV_NMSIS_NN_SUCCESS
on successful completion.
-
void riscv_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.
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.
- Parameters
Im_in – [inout] pointer to input tensor
dim_im_in – [in] input tensor dimention
ch_im_in – [in] number of input tensor channels
dim_kernel – [in] filter kernel size
padding – [in] padding sizes
stride – [in] convolution stride
dim_im_out – [in] output tensor dimension
bufferA – [inout] Not used
Im_out – [inout] pointer to output tensor
-
void riscv_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.
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.
- Parameters
Im_in – [inout] pointer to input tensor
dim_im_in – [in] input tensor dimention
ch_im_in – [in] number of input tensor channels
dim_kernel – [in] filter kernel size
padding – [in] padding sizes
stride – [in] convolution stride
dim_im_out – [in] output tensor dimension
bufferA – [inout] pointer to buffer space for input
Im_out – [inout] pointer to output tensor
-
riscv_nmsis_nn_status riscv_avgpool_s16(const nmsis_nn_context *ctx, const nmsis_nn_pool_params *pool_params, const nmsis_nn_dims *input_dims, const int16_t *src, const nmsis_nn_dims *filter_dims, const nmsis_nn_dims *output_dims, int16_t *dst)