The pooling functions are used to downsample input data. They include max and average pooling functions. More...
Functions | |
| static void | hpm_nn_avepool_HWC_s8 (q7_t *in_tensor, const uint16_t in_tensor_dim, const uint16_t in_tensor_ch, const uint16_t ker_dim, const uint16_t pad, const uint16_t stride, const uint16_t out_tensor_dim, q7_t *in_tmp_buf, q7_t *out_tensor) |
| This is an average pooling function for signed 8-bit integer inputs. More... | |
| static void | hpm_nn_avepool_HWC_s8_any (q7_t *in_tensor, const uint16_t in_tensor_dim_x, const uint16_t in_tensor_dim_y, const uint16_t in_tensor_ch, const uint16_t ker_dim_x, const uint16_t ker_dim_y, const uint16_t pad_x, const uint16_t pad_y, const uint16_t stride_x, const uint16_t stride_y, const uint16_t out_tensor_dim_x, const uint16_t out_tensor_dim_y, q7_t *in_tmp_buf, q7_t *out_tensor, const uint16_t out_lshift) |
| This is an average pooling function for signed 8-bit integer inputs in any x and y dimensions. More... | |
| static int32_t | hpm_nn_avepool_HWC_s8_any_act (const int in_tensor_dim_y, const int in_tensor_dim_x, const int out_tensor_dim_y, const int out_tensor_dim_x, const int stride_y, const int stride_x, const int ker_dim_y, const int ker_dim_x, const int pad_y, const int pad_x, const int act_min, const int act_max, const int in_tensor_ch, int8_t *in_tensor, int16_t *in_tmp_buf, int8_t *out_tensor) |
| This is an average pooling function for S8 inputs with any x and y dimension with the actvating parameters to limit the outputs. More... | |
| static int32_t | hpm_nn_avepool_HWC_s8_any_act_get_buffer_size (const int out_tensor_dim_x, const int in_tensor_ch) |
| This function is used to obtain the required size, in bytes, for the input temporary buffer of riscv_nn_avepool_HWC_s8_any_act. More... | |
| static void | hpm_nn_maxpool_HWC_s8 (q7_t *in_tensor, const uint16_t in_tensor_dim, const uint16_t in_tensor_ch, const uint16_t ker_dim, const uint16_t pad, const uint16_t stride, const uint16_t out_tensor_dim, q7_t *in_tmp_buf, q7_t *out_tensor) |
| This is a max pooling function for signed 8-bit integer inputs. More... | |
| static int32_t | hpm_nn_maxpool_HWC_s8_any_act (const uint16_t in_tensor_dim_y, const uint16_t in_tensor_dim_x, const uint16_t out_tensor_dim_y, const uint16_t out_tensor_dim_x, const uint16_t stride_y, const uint16_t stride_x, const uint16_t ker_dim_y, const uint16_t ker_dim_x, const uint16_t pad_y, const uint16_t pad_x, const int8_t act_min, const int8_t act_max, const uint16_t in_tensor_ch, int8_t *in_tensor, int16_t *tmp_buffer, int8_t *out_tensor) |
| This is a max pooling function for signed 8-bit integer inputs in any x and y dimensions with the actvating parameters to limit the outputs. More... | |
The pooling functions are used to downsample input data. They include max and average pooling functions.
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is an average pooling function for signed 8-bit integer inputs.
| [in] | in_tensor | pointer of the input tensor |
| [in] | in_tensor_dim | dimension of the input tensor |
| [in] | in_tensor_ch | number of input tensor channels |
| [in] | ker_dim | dimension of the filter kernel |
| [in] | pad | padding size |
| [in] | stride | convolution stride |
| [in] | out_tensor_dim | dimension of the output tensor |
| [in] | in_tmp_buf | temporary buffer for the input tensor |
| [out] | out_tensor | pointer of the output tensor. It is required when -mext-dsp is enabled and its size must be equal to "2 * out_tensor_dim * in_tensor_ch". |
Example:
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is an average pooling function for signed 8-bit integer inputs in any x and y dimensions.
| [in] | in_tensor | pointer of the input tensor |
| [in] | in_tensor_dim_x | x dimension of the input tensor |
| [in] | in_tensor_dim_y | y dimension of the input tensor |
| [in] | in_tensor_ch | number of input tensor channels |
| [in] | ker_dim_x | x dimension of the filter kernel |
| [in] | ker_dim_y | y dimension of the filter kernel |
| [in] | pad_x | padding size in the x dimension |
| [in] | pad_y | padding size in the y dimension |
| [in] | stride_x | convolution stride in the x dimension |
| [in] | stride_y | convolution stride in the y dimension |
| [in] | out_tensor_dim_x | x dimension of the output tensor |
| [in] | out_tensor_dim_y | y dimension of the output tensor |
| [in] | in_tmp_buf | temporary buffer for the input tensor. It is required when -mext-dsp is enabled and its size must be equal to "2 * out_tensor_dim_x * in_tensor_ch". |
| [out] | out_tensor | pointer of the output tensor |
| [in] | out_lshift | left shift amount for the output |
Example:
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is an average pooling function for S8 inputs with any x and y dimension with the actvating parameters to limit the outputs.
| [in] | in_tensor_dim_y | y dimension of the input tensor |
| [in] | in_tensor_dim_x | x dimension of the input tensor |
| [in] | out_tensor_dim_y | y dimension of the output tensor |
| [in] | out_tensor_dim_x | x dimension of the output tensor |
| [in] | stride_y | convolution stride in the y dimension |
| [in] | stride_x | convolution stride in the x dimension |
| [in] | ker_dim_y | y dimension of the filter kernel |
| [in] | ker_dim_x | x dimension of the filter kernel |
| [in] | pad_y | padding size in the y dimension |
| [in] | pad_x | padding size in the x dimension |
| [in] | act_min | minimum value that the output tensor is limited to. It should be in the range of -128 to 127. |
| [in] | act_max | maximum value that the output tensor is limited to. It should be in the range of -128 to 127. |
| [in] | in_tensor_ch | number of input tensor channels |
| [in] | in_tensor | pointer of the input tensor |
| [in] | in_tmp_buf | temporary buffer for the input tensor. Its needed size could be obtained by calling riscv_nn_avepool_s8_HWC_any_get_buffer_size. |
| [out] | out_tensor | pointer of the output tensor |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function is used to obtain the required size, in bytes, for the input temporary buffer of riscv_nn_avepool_HWC_s8_any_act.
| [in] | out_tensor_dim_x | x dimension of the output tensor |
| [in] | in_tensor_ch | number of input tensor channels |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is a max pooling function for signed 8-bit integer inputs.
| [in] | in_tensor | pointer of the input tensor |
| [in] | in_tensor_dim | dimension of the input tensor |
| [in] | in_tensor_ch | number of input tensor channels |
| [in] | ker_dim | dimension of the filter kernel |
| [in] | pad | padding size |
| [in] | stride | convolution stride |
| [in] | out_tensor_dim | dimension of the output tensor |
| [in] | in_tmp_buf | dummy |
| [out] | out_tensor | pointer of the output tensor |
Example:
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is a max pooling function for signed 8-bit integer inputs in any x and y dimensions with the actvating parameters to limit the outputs.
| [in] | in_tensor_dim_y | y dimension of the input tensor |
| [in] | in_tensor_dim_x | x dimension of the input tensor |
| [in] | out_tensor_dim_y | y dimension of the output tensor |
| [in] | out_tensor_dim_x | x dimension of the output tensor |
| [in] | stride_y | convolution stride in the y dimension |
| [in] | stride_x | convolution stride in the x dimension |
| [in] | ker_dim_y | y dimension of the filter kernel |
| [in] | ker_dim_x | x dimension of the filter kernel |
| [in] | pad_y | padding size in the y dimension |
| [in] | pad_x | padding size in the x dimension |
| [in] | act_min | minimum value that the output tensor is limited to. It should be in the range of -128 to 127. |
| [in] | act_max | maximum value that the output tensor is limited to. It should be in the range of -128 to 127. |
| [in] | in_tensor_ch | number of input tensor channels |
| [in] | in_tensor | pointer of the input tensor |
| [in] | tmp_buffer | dummy |
| [in] | out_tensor | pointer of the output tensor |