NMSIS-NN
Version 1.3.1
NMSIS NN Software Library
|
Perform pooling functions, including max pooling and average pooling. More...
Modules | |
GetBufferSizePooling | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Perform pooling functions, including max pooling and average pooling.
Perform max and average pooling operations.
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.
[in,out] | Im_in | pointer to input tensor |
[in] | dim_im_in | input tensor dimention |
[in] | ch_im_in | number of input tensor channels |
[in] | dim_kernel | filter kernel size |
[in] | padding | padding sizes |
[in] | stride | convolution stride |
[in] | dim_im_out | output tensor dimension |
[in,out] | bufferA | pointer to buffer space for input |
[in,out] | Im_out | pointer 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.
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 * | input_data, | ||
const nmsis_nn_dims * | filter_dims, | ||
const nmsis_nn_dims * | output_dims, | ||
int16_t * | output_data | ||
) |
s16 average pooling function.
[in,out] | ctx | 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. |
[in] | pool_params | Pooling parameters |
[in] | input_dims | Input (activation) tensor dimensions. Format: [H, W, C_IN] |
[in] | input_data | Input (activation) data pointer. Data type: int16 |
[in] | filter_dims | Filter tensor dimensions. Format: [H, W] Argument N and C are not used. |
[in] | output_dims | Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN. |
[in,out] | output_data | Output data pointer. Data type: int16 |
RISCV_NMSIS_NN_SUCCESS
- Successful operation RISCV_NMSIS_NN_ARG_ERROR
- In case of invalid argumentsriscv_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 * | input_data, | ||
const nmsis_nn_dims * | filter_dims, | ||
const nmsis_nn_dims * | output_dims, | ||
int8_t * | output_data | ||
) |
s8 average pooling function.
[in,out] | ctx | 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. |
[in] | pool_params | Pooling parameters |
[in] | input_dims | Input (activation) tensor dimensions. Format: [H, W, C_IN] |
[in] | input_data | Input (activation) data pointer. Data type: int8 |
[in] | filter_dims | Filter tensor dimensions. Format: [H, W] Argument N and C are not used. |
[in] | output_dims | Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN. |
[in,out] | output_data | Output data pointer. Data type: int8 |
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.
[in,out] | ctx | 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. |
[in] | pool_params | Pooling parameters |
[in] | input_dims | Input (activation) tensor dimensions. Format: [H, W, C_IN] |
[in] | src | Input (activation) data pointer. The input tensor must not overlap with the output tensor. Data type: int16 |
[in] | filter_dims | Filter tensor dimensions. Format: [H, W] Argument N and C are not used. |
[in] | output_dims | Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN. |
[in,out] | dst | Output data pointer. Data type: int16 |
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 * | input_data, | ||
const nmsis_nn_dims * | filter_dims, | ||
const nmsis_nn_dims * | output_dims, | ||
int8_t * | output_data | ||
) |
s8 max pooling function.
[in,out] | ctx | 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. |
[in] | pool_params | Pooling parameters |
[in] | input_dims | Input (activation) tensor dimensions. Format: [H, W, C_IN] |
[in] | input_data | Input (activation) data pointer. The input tensor must not overlap with the output tensor. Data type: int8 |
[in] | filter_dims | Filter tensor dimensions. Format: [H, W] Argument N and C are not used. |
[in] | output_dims | Output tensor dimensions. Format: [H, W, C_OUT] Argument N is not used. C_OUT equals C_IN. |
[in,out] | output_data | Output data pointer. Data type: int8 |
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.
[in,out] | Im_in | pointer to input tensor |
[in] | dim_im_in | input tensor dimention |
[in] | ch_im_in | number of input tensor channels |
[in] | dim_kernel | filter kernel size |
[in] | padding | padding sizes |
[in] | stride | convolution stride |
[in] | dim_im_out | output tensor dimension |
[in,out] | bufferA | Not used |
[in,out] | Im_out | pointer 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.