NMSIS-NN  Version 1.2.0
NMSIS NN Software Library
LSTM Layer Functions

Functions

riscv_nmsis_nn_status riscv_lstm_unidirectional_s16_s8 (nmsis_nn_lstm_context *scratch_buffers, const int8_t *input_data, const nmsis_nn_lstm_dims *lstm_dims, const int8_t *in_to_in_weights, const int8_t *in_to_forget_weights, const int8_t *in_to_cell_weights, const int8_t *in_to_out_weights, const int8_t *recurrent_to_in_weights, const int8_t *recurrent_to_forget_weights, const int8_t *recurrent_to_cell_weights, const int8_t *recurrent_to_out_weights, const int16_t *cell_to_in_weights, const int16_t *cell_to_forget_weights, const int16_t *cell_to_out_weights, const int8_t *projection_weights, const nmsis_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...
 

Detailed Description

Function Documentation

◆ riscv_lstm_unidirectional_s16_s8()

riscv_nmsis_nn_status riscv_lstm_unidirectional_s16_s8 ( nmsis_nn_lstm_context scratch_buffers,
const int8_t *  input_data,
const nmsis_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 nmsis_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.

Parameters
[in]scratch_buffersStruct containing scratch buffers Expected size for each scratch buffer is lstm_dims->num_batches * lstm_dims->num_outputs.
[in]input_dataPointer to input data
[in]lstm_dimsLSTM input parameters related to dimensions
[in]input_to_input_weightsInput to input weights
[in]input_to_forget_weightsInput to forget weights
[in]input_to_cell_weightsInput to cell weights
[in]input_to_output_weightsInput to output weights
[in]recurrent_to_input_weightsRecurrent to input weights
[in]recurrent_to_forget_weightsRecurrent to forget weights
[in]recurrent_to_cell_weightsRecurrent to cell weights
[in]recurrent_to_output_weightsRecurrent to output weights
[in]cell_to_input_weightsCell to input weights. Not used.
[in]cell_to_forget_weightsCell to forget weights. Not used.
[in]cell_to_output_weightsCell to output weights. Not used.
[in]projection_weightsProjection weights. Not used.
[in]lstmLSTM parameters. See struct declaration
[in]output_statePointer to (recurrent) output state
[in]cell_statePointer to cell state
[in]output_dataPointer to output state
Note
Following assumptions are done based on LSTM functionality as supported by Keras version 2.9.0 at the time of development. As stated here, https://github.com/tensorflow/community/blob/master/rfcs/20180920-unify-rnn-interface.md Keras's LSTMCell is equivalent to TensorFlow's BasicLSTMCell, which does not support peephole, clipping or projection. Layer normalization and combined input/forget gate are not supported either.

1 Input to input weight can not be nullptr. Otherwise nullptr for combined input/forgat gate. 2 Cell weights are not used and should be nullptr. Otherwise needed for peephole connections. 3 Projection weight is not used and should be nullpr. Otherwise needed for projection.

Returns
The function returns RISCV_NMSIS_NN_SUCCESS
  1. Supported framework: TensorFlow Lite micro