Neural Network Pooling Functions

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.

Functions

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.

Buffer size:

Return

none.

Parameters
  • [inout] 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

  • [inout] bufferA: pointer to buffer space for input

  • [inout] Im_out: pointer to output tensor

bufferA size: 0

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.

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:

Return

none.

Parameters
  • [inout] 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

  • [inout] bufferA: pointer to buffer space for input

  • [inout] Im_out: pointer to output tensor

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.