Function arm_lstm_unidirectional_s8_temp1_get_buffer_size¶
Defined in File arm_nnfunctions.h
Function Documentation¶
-
int32_t arm_lstm_unidirectional_s8_temp1_get_buffer_size(const cmsis_nn_lstm_params *lstm_params)¶
Get size of the temp1 scratch buffer required by arm_lstm_unidirectional_s8().
Note
time_steps does not enter the requirement: the buffer is reused by every step. A layer with time_steps == 0 runs no step and never dereferences the buffer, but the query still reports the per-step figure rather than 0.
Note
0 is only returned for a degenerate shape (batch_size or hidden_size of 0), for which arm_lstm_unidirectional_s8() makes no scratch access, so { NULL } is acceptable there per the README.md buffer convention. There is no runtime enforcement: the kernel does not range-check the buffers, and an undersized allocation is written past on every build target.
- Parameters:
lstm_params – [in] LSTM operator parameters, i.e. the same cmsis_nn_lstm_params passed to arm_lstm_unidirectional_s8(). Only time_major, batch_size and hidden_size are read.
- Returns:
Required buffer size in bytes: (time_major != 0 ? batch_size : 1) * hidden_size * sizeof(int16_t). The elements are int16_t gate outputs even though the layer datatype is s8. batch_size enters only for a time-major layer because the batch-major wrapper always re-invokes the step kernel one batch at a time. Returns -1 if lstm_params is NULL, if batch_size or hidden_size is negative, or if the product would not fit in an int32_t. The figure and the range checks are the same on every build target.