CMSIS-NN
CMSIS NN Software Library
|
Functions | |
void | arm_nn_lstm_calculate_gate_s8_s16 (const int8_t *input, const int8_t *input_to_gate_weights, const int32_t *input_to_gate_bias, const cmsis_nn_scaling input_to_gate_scaling, const int8_t *output_state, const int8_t *recurrent_to_gate_weights, const int32_t *recurrent_to_gate_bias, const cmsis_nn_scaling recurrent_to_gate, const int32_t n_batch, const int32_t n_input, const int32_t n_output, const int32_t n_cell, const arm_nn_activation_type activation_type, int16_t *gate) |
Updates a LSTM gate for an iteration step of LSTM function, int8x8_16 version. More... | |
arm_cmsis_nn_status | arm_nn_lstm_step_s8_s16 (const int8_t *input, const int8_t *input_to_input_weight, const int8_t *input_to_forget_weight, const int8_t *input_to_cell_weight, const int8_t *input_to_output_weight, const int8_t *recurrent_to_input_weight, const int8_t *recurrent_to_forget_weight, const int8_t *recurrent_to_cell_weight, const int8_t *recurrent_to_output_weight, const cmsis_nn_lstm_params *lstm, const int n_batch, const int n_cell, const int n_input, const int n_output, int8_t *output_state, int16_t *cell_state, int8_t *output, cmsis_nn_lstm_context *scratch_buffers) |
Update LSTM function for an iteration step. More... | |
void | arm_nn_lstm_update_cell_state_s16 (const int32_t n_block, const int32_t cell_state_scale, int16_t *cell_state, const int16_t *input_gate, const int16_t *forget_gate, const int16_t *cell_gate) |
Update cell state for a single LSTM iteration step, int8x8_16 version. More... | |
void | arm_nn_lstm_update_output_s8_s16 (const int n_batch, const int n_cell, int16_t *cell_state, const int32_t cell_state_scale, const int16_t *output_gate, const cmsis_nn_scaling hidden_scaling, const int32_t hidden_offset, int8_t *output_state, int16_t *cell_gate_scratch) |
Calculate the output state tensor of an LSTM step, s8 input/output and s16 weight version. More... | |
void | arm_nn_vec_mat_mul_result_acc_s8 (const int8_t *lhs_in, const int8_t *rhs_in, const int32_t *bias, int16_t *dst, const int32_t dst_offset, const int32_t dst_multiplier, const int32_t dst_shift, const int32_t rhs_cols, const int32_t rhs_rows, const int32_t batch) |
The result of the multiplication is accumulated to the passed result buffer. Multiplies a matrix by a "batched" vector (i.e. a matrix with a batch dimension composed by input vectors independent from each other). More... | |
Support functions for LSTM
void arm_nn_lstm_calculate_gate_s8_s16 | ( | const int8_t * | input, |
const int8_t * | input_to_gate_weights, | ||
const int32_t * | input_to_gate_bias, | ||
const cmsis_nn_scaling | input_to_gate_scaling, | ||
const int8_t * | output_state, | ||
const int8_t * | recurrent_to_gate_weights, | ||
const int32_t * | recurrent_to_gate_bias, | ||
const cmsis_nn_scaling | recurrent_to_gate_scaling, | ||
const int32_t | n_batch, | ||
const int32_t | n_input, | ||
const int32_t | n_output, | ||
const int32_t | n_cell, | ||
const arm_nn_activation_type | activation_type, | ||
int16_t * | gate | ||
) |
param[in] input Input data param[in] input_to_gate_weights Input to gate weights param[in] input_to_gate_bias Input to gate weights param[in] input_to_gate_scaling Input to gate scaling param[in] activation Actival min and max values param[in] output_state Output state param[in] recurrent_to_gate_weights Recurrent to gate weights param[in] recurrent_to_gate_bias Recurrent to gate bias param[in] recurrent_to_gate_scaling Recurrent to gate scaling param[in] n_batch Batch size param[in] n_input Input size param[out] n_output Output size param[in] activation_type Activation type (sigmoid or tanh) param[out] n_cell Cell size
arm_cmsis_nn_status arm_nn_lstm_step_s8_s16 | ( | const int8_t * | input, |
const int8_t * | input_to_input_weight, | ||
const int8_t * | input_to_forget_weight, | ||
const int8_t * | input_to_cell_weight, | ||
const int8_t * | input_to_output_weight, | ||
const int8_t * | recurrent_to_input_weight, | ||
const int8_t * | recurrent_to_forget_weight, | ||
const int8_t * | recurrent_to_cell_weight, | ||
const int8_t * | recurrent_to_output_weight, | ||
const cmsis_nn_lstm_params * | lstm, | ||
const int | n_batch, | ||
const int | n_cell, | ||
const int | n_input, | ||
const int | n_output, | ||
int8_t * | output_state, | ||
int16_t * | cell_state, | ||
int8_t * | output, | ||
cmsis_nn_lstm_context * | scratch_buffers | ||
) |
param[in] input Input data param[in] input_to_input_weight Input to input gate weights param[in] input_to_forget_weight Input to forget gate weights param[in] input_to_cell_weight Input to cell gate weights param[in] input_to_output_weight Input to output weights param[in] recurrent_to_input_weight Recurrent signal to input weights param[in] recurrent_to_forget_weight Recurrent signal to forget gate weights param[in] recurrent_to_cell_weight Recurrent signal to cell gate weighst param[in] recurrent_to_output_weight Recurrent signal to output weights param[in] lstm LSTM parameters param[in] n_batch Batch size param[in] n_cell Cell size param[in] n_input Input size param[in] n_output Output size param[out] output_state Output state param[out] cell_state Internal state param[out] output Output signal param[in] *scratch_buffers Struct containing scratch buffers
void arm_nn_lstm_update_cell_state_s16 | ( | const int32_t | n_block, |
const int32_t | cell_state_scale, | ||
int16_t * | cell_state, | ||
const int16_t * | input_gate, | ||
const int16_t * | forget_gate, | ||
const int16_t * | cell_gate | ||
) |
[in] | n_block | total number of cells for all batches |
[in] | cell_state_scale | Scaling factor of cell state |
[in] | cell_state | Input/output vector, size n_batch*n_cell |
[in] | input_gate | Input vector of size n_block |
[in] | forget_gate | Input/scratch vector of size n_block, always modified |
[in] | cell_gate | Input vector of size, n_block |
void arm_nn_lstm_update_output_s8_s16 | ( | const int | n_batch, |
const int | n_cell, | ||
int16_t * | cell_state, | ||
const int32_t | cell_state_scale, | ||
const int16_t * | output_gate, | ||
const cmsis_nn_scaling | hidden_scale, | ||
const int32_t | hidden_offset, | ||
int8_t * | output_state, | ||
int16_t * | cell_gate_scratch | ||
) |
[in] | n_batch | The number of distinct vectors in each array |
[in] | n_cell | Number of cells |
[in,out] | cell_state | Cell state, size n_batch*n_cell |
[in] | cell_state_scale | Scaling of cell_state |
[in] | output_gate | Output gate |
[in] | hidden_scale | Effective scaling of cell_state .* output_gate |
[in] | hidden_offset | Zero point for cell_state .* output_gate |
[out] | output_state | Output state |
[in] | cell_gate_scratch | Scratch buffer |
void arm_nn_vec_mat_mul_result_acc_s8 | ( | const int8_t * | lhs_in, |
const int8_t * | rhs_in, | ||
const int32_t * | bias, | ||
int16_t * | dst, | ||
const int32_t | dst_offset, | ||
const int32_t | dst_multiplier, | ||
const int32_t | dst_shift, | ||
const int32_t | rhs_cols, | ||
const int32_t | rhs_rows, | ||
const int32_t | batch | ||
) |
[in] | lhs_in | Batched vector |
[in] | rhs_in | Weights - input matrix (H(Rows)xW(Columns)) |
[in] | bias | Bias vector |
[out] | dst | Output |
[in] | dst_offset | Output offset |
[in] | dst_multiplier | Multiplier for quantization |
[in] | dst_shift | Shift for quantization |
[in] | rhs_cols | Vector/matarix column length |
[in] | rhs_rows | Row count of matrix |
[in] | batch | Batch size |