CMSIS-NN  
CMSIS NN Software Library
arm_nnfunctions.h File Reference

Macros

#define USE_INTRINSIC
 

Functions

arm_cmsis_nn_status arm_convolve_wrapper_s8 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 s8 convolution layer wrapper function with the main purpose to call the optimal kernel available in cmsis-nn to perform the convolution. More...
 
int32_t arm_convolve_wrapper_s8_get_buffer_size (const cmsis_nn_conv_params *conv_params, const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims)
 Get the required buffer size for arm_convolve_wrapper_s8. More...
 
arm_cmsis_nn_status arm_convolve_wrapper_s16 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 s16 convolution layer wrapper function with the main purpose to call the optimal kernel available in cmsis-nn to perform the convolution. More...
 
int32_t arm_convolve_wrapper_s16_get_buffer_size (const cmsis_nn_conv_params *conv_params, const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims)
 Get the required buffer size for arm_convolve_wrapper_s16. More...
 
arm_cmsis_nn_status arm_convolve_s8 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Basic s8 convolution function. More...
 
int32_t arm_convolve_s8_get_buffer_size (const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims)
 Get the required buffer size for s8 convolution function. More...
 
arm_cmsis_nn_status arm_convolve_s16 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 Basic s16 convolution function. More...
 
arm_cmsis_nn_status arm_convolve_fast_s16 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 Optimized s16 convolution function. More...
 
int32_t arm_convolve_s16_get_buffer_size (const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims)
 Get the required buffer size for s16 convolution function. More...
 
int32_t arm_convolve_fast_s16_get_buffer_size (const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims)
 Get the required buffer size for fast s16 convolution function. More...
 
arm_cmsis_nn_status arm_convolve_1x1_s8_fast (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Fast s8 version for 1x1 convolution (non-square shape) More...
 
int32_t arm_convolve_1x1_s8_fast_get_buffer_size (const cmsis_nn_dims *input_dims)
 Get the required buffer size for arm_convolve_1x1_s8_fast. More...
 
arm_cmsis_nn_status arm_convolve_1x1_s8 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 s8 version for 1x1 convolution with support for non-unity stride values More...
 
arm_cmsis_nn_status arm_convolve_1_x_n_s8 (const cmsis_nn_context *ctx, const cmsis_nn_conv_params *conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 1xn convolution More...
 
int32_t arm_convolve_1_x_n_s8_get_buffer_size (const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims)
 Get the required additional buffer size for 1xn convolution. More...
 
arm_cmsis_nn_status arm_depthwise_conv_wrapper_s8 (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Wrapper function to pick the right optimized s8 depthwise convolution function. More...
 
int32_t arm_depthwise_conv_wrapper_s8_get_buffer_size (const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims)
 Get size of additional buffer required by arm_depthwise_conv_wrapper_s8() More...
 
arm_cmsis_nn_status arm_depthwise_conv_s8 (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Basic s8 depthwise convolution function that doesn't have any constraints on the input dimensions. More...
 
arm_cmsis_nn_status arm_depthwise_conv_s16 (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 Basic s16 depthwise convolution function that doesn't have any constraints on the input dimensions. More...
 
arm_cmsis_nn_status arm_depthwise_conv_wrapper_s16 (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 Wrapper function to pick the right optimized s16 depthwise convolution function. More...
 
int32_t arm_depthwise_conv_wrapper_s16_get_buffer_size (const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims)
 Get size of additional buffer required by arm_depthwise_conv_wrapper_s16() More...
 
arm_cmsis_nn_status arm_depthwise_conv_fast_s16 (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 Optimized s16 depthwise convolution function with constraint that in_channel equals out_channel. Refer arm_depthwise_conv_s16() for function argument details. More...
 
int32_t arm_depthwise_conv_fast_s16_get_buffer_size (const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims)
 Get the required buffer size for optimized s16 depthwise convolution function with constraint that in_channel equals out_channel. More...
 
arm_cmsis_nn_status arm_depthwise_conv_3x3_s8 (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Optimized s8 depthwise convolution function for 3x3 kernel size with some constraints on the input arguments(documented below). Refer arm_depthwise_conv_s8() for function argument details. More...
 
arm_cmsis_nn_status arm_depthwise_conv_s8_opt (const cmsis_nn_context *ctx, const cmsis_nn_dw_conv_params *dw_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Optimized s8 depthwise convolution function with constraint that in_channel equals out_channel. Refer arm_depthwise_conv_s8() for function argument details. More...
 
int32_t arm_depthwise_conv_s8_opt_get_buffer_size (const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims)
 Get the required buffer size for optimized s8 depthwise convolution function with constraint that in_channel equals out_channel. More...
 
arm_cmsis_nn_status arm_fully_connected_s8 (const cmsis_nn_context *ctx, const cmsis_nn_fc_params *fc_params, const cmsis_nn_per_tensor_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 Basic s8 Fully Connected function. More...
 
int32_t arm_fully_connected_s8_get_buffer_size (const cmsis_nn_dims *filter_dims)
 Get the required buffer size for S8 basic fully-connected and matrix multiplication layer function for TF Lite. More...
 
arm_cmsis_nn_status arm_fully_connected_s16 (const cmsis_nn_context *ctx, const cmsis_nn_fc_params *fc_params, const cmsis_nn_per_tensor_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)
 Basic s16 Fully Connected function. More...
 
int32_t arm_fully_connected_s16_get_buffer_size (const cmsis_nn_dims *filter_dims)
 Get the required buffer size for S16 basic fully-connected and matrix multiplication layer function for TF Lite. More...
 
arm_cmsis_nn_status arm_elementwise_add_s8 (const int8_t *input_1_vect, const int8_t *input_2_vect, const int32_t input_1_offset, const int32_t input_1_mult, const int32_t input_1_shift, const int32_t input_2_offset, const int32_t input_2_mult, const int32_t input_2_shift, const int32_t left_shift, int8_t *output, const int32_t out_offset, const int32_t out_mult, const int32_t out_shift, const int32_t out_activation_min, const int32_t out_activation_max, const int32_t block_size)
 s8 elementwise add of two vectors More...
 
arm_cmsis_nn_status arm_elementwise_add_s16 (const int16_t *input_1_vect, const int16_t *input_2_vect, const int32_t input_1_offset, const int32_t input_1_mult, const int32_t input_1_shift, const int32_t input_2_offset, const int32_t input_2_mult, const int32_t input_2_shift, const int32_t left_shift, int16_t *output, const int32_t out_offset, const int32_t out_mult, const int32_t out_shift, const int32_t out_activation_min, const int32_t out_activation_max, const int32_t block_size)
 s16 elementwise add of two vectors More...
 
arm_cmsis_nn_status arm_elementwise_mul_s8 (const int8_t *input_1_vect, const int8_t *input_2_vect, const int32_t input_1_offset, const int32_t input_2_offset, int8_t *output, const int32_t out_offset, const int32_t out_mult, const int32_t out_shift, const int32_t out_activation_min, const int32_t out_activation_max, const int32_t block_size)
 s8 elementwise multiplication More...
 
arm_cmsis_nn_status arm_elementwise_mul_s16 (const int16_t *input_1_vect, const int16_t *input_2_vect, const int32_t input_1_offset, const int32_t input_2_offset, int16_t *output, const int32_t out_offset, const int32_t out_mult, const int32_t out_shift, const int32_t out_activation_min, const int32_t out_activation_max, const int32_t block_size)
 s16 elementwise multiplication More...
 
void arm_relu_q7 (int8_t *data, uint16_t size)
 Q7 RELU function. More...
 
void arm_relu6_s8 (int8_t *data, uint16_t size)
 s8 ReLU6 function More...
 
void arm_relu_q15 (int16_t *data, uint16_t size)
 Q15 RELU function. More...
 
void arm_nn_activation_s16 (const int16_t *input, int16_t *output, const uint16_t size, const uint16_t left_shift, const arm_nn_activation_type type)
 s16 neural network activation function using direct table look-up 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 int8_t *input_data, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, int8_t *output_data)
 s8 average pooling function. More...
 
int32_t arm_avgpool_s8_get_buffer_size (const int dim_dst_width, const int ch_src)
 Get the required buffer size for S8 average pooling function. More...
 
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)
 s16 average pooling function. More...
 
int32_t arm_avgpool_s16_get_buffer_size (const int dim_dst_width, const int ch_src)
 Get the required buffer size for S16 average 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 int8_t *input_data, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, int8_t *output_data)
 s8 max 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...
 
void arm_softmax_s8 (const int8_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const int32_t diff_min, int8_t *output)
 S8 softmax function. More...
 
void arm_softmax_s8_s16 (const int8_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const int32_t diff_min, int16_t *output)
 S8 to s16 softmax function. More...
 
arm_cmsis_nn_status arm_softmax_s16 (const int16_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const cmsis_nn_softmax_lut_s16 *softmax_params, int16_t *output)
 S16 softmax function. More...
 
void arm_softmax_u8 (const uint8_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const int32_t diff_min, uint8_t *output)
 U8 softmax function. More...
 
void arm_reshape_s8 (const int8_t *input, int8_t *output, const uint32_t total_size)
 Reshape a s8 vector into another with different shape. More...
 
void arm_concatenation_s8_x (const int8_t *input, const uint16_t input_x, const uint16_t input_y, const uint16_t input_z, const uint16_t input_w, int8_t *output, const uint16_t output_x, const uint32_t offset_x)
 int8/uint8 concatenation function to be used for concatenating N-tensors along the X axis This function should be called for each input tensor to concatenate. The argument offset_x will be used to store the input tensor in the correct position in the output tensor More...
 
void arm_concatenation_s8_y (const int8_t *input, const uint16_t input_x, const uint16_t input_y, const uint16_t input_z, const uint16_t input_w, int8_t *output, const uint16_t output_y, const uint32_t offset_y)
 int8/uint8 concatenation function to be used for concatenating N-tensors along the Y axis This function should be called for each input tensor to concatenate. The argument offset_y will be used to store the input tensor in the correct position in the output tensor More...
 
void arm_concatenation_s8_z (const int8_t *input, const uint16_t input_x, const uint16_t input_y, const uint16_t input_z, const uint16_t input_w, int8_t *output, const uint16_t output_z, const uint32_t offset_z)
 int8/uint8 concatenation function to be used for concatenating N-tensors along the Z axis This function should be called for each input tensor to concatenate. The argument offset_z will be used to store the input tensor in the correct position in the output tensor More...
 
void arm_concatenation_s8_w (const int8_t *input, const uint16_t input_x, const uint16_t input_y, const uint16_t input_z, const uint16_t input_w, int8_t *output, const uint32_t offset_w)
 int8/uint8 concatenation function to be used for concatenating N-tensors along the W axis (Batch size) This function should be called for each input tensor to concatenate. The argument offset_w will be used to store the input tensor in the correct position in the output tensor More...
 
arm_cmsis_nn_status arm_svdf_s8 (const cmsis_nn_context *input_ctx, const cmsis_nn_context *output_ctx, const cmsis_nn_svdf_params *svdf_params, const cmsis_nn_per_tensor_quant_params *input_quant_params, const cmsis_nn_per_tensor_quant_params *output_quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *state_dims, int8_t *state_data, const cmsis_nn_dims *weights_feature_dims, const int8_t *weights_feature_data, const cmsis_nn_dims *weights_time_dims, const int8_t *weights_time_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 s8 SVDF function with 8 bit state tensor and 8 bit time weights More...
 
arm_cmsis_nn_status arm_svdf_state_s16_s8 (const cmsis_nn_context *input_ctx, const cmsis_nn_context *output_ctx, const cmsis_nn_svdf_params *svdf_params, const cmsis_nn_per_tensor_quant_params *input_quant_params, const cmsis_nn_per_tensor_quant_params *output_quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *state_dims, int16_t *state_data, const cmsis_nn_dims *weights_feature_dims, const int8_t *weights_feature_data, const cmsis_nn_dims *weights_time_dims, const int16_t *weights_time_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)
 s8 SVDF function with 16 bit state tensor and 16 bit time weights More...
 
arm_cmsis_nn_status arm_lstm_unidirectional_s16_s8 (cmsis_nn_lstm_context *scratch_buffers, const int8_t *input_data, const cmsis_nn_lstm_dims *lstm_dims, const int8_t *input_to_input_weights, const int8_t *input_to_forget_weights, const int8_t *input_to_cell_weights, const int8_t *input_to_output_weights, const int8_t *recurrent_to_input_weights, const int8_t *recurrent_to_forget_weights, const int8_t *recurrent_to_cell_weights, const int8_t *recurrent_to_output_weights, const int16_t *cell_to_input_weights, const int16_t *cell_to_forget_weights, const int16_t *cell_to_output_weights, const int8_t *projection_weights, const cmsis_nn_lstm_params *lstm, int8_t *output_state, int16_t *cell_state, int8_t *output_data)
 LSTM unidirectional function with 8 bit input and output and 16 bit gate output Peephole connections, projection, clipping, combined input/forget gate and layer normalization are not supported. More...
 

Macro Definition Documentation

◆ USE_INTRINSIC

#define USE_INTRINSIC