Function arm_gru_unidirectional_f16

Function Documentation

arm_cmsis_nn_status arm_gru_unidirectional_f16(const float16_t *input, float16_t *output, const cmsis_nn_gru_params_f16 *params, cmsis_nn_gru_context_f16 *buffers)

Unidirectional GRU layer for float16 input, output and state.

Implements the reset-after GRU (Keras / TFLite default) when params->reset_after is non-zero, and the pre-reset variant otherwise. The hidden state is zero-initialised for the first time step, unless buffers->hidden_state is supplied for streaming state carry (batch_size == 1), in which case it seeds the initial state and receives the final hidden state on return.

Note

NaN contract: a NaN in input, the previous hidden state, or the candidate gate’s weight or bias reaches every output unit it feeds, on the scalar and MVE legs alike and at the shipped -Ofast: the MVE block re-establishes NaN after the table tanh with an integer-domain test that fast-math cannot elide (#251). A NaN confined to the update or reset gate’s weight or bias does not reach the output: the scalar sigmoid maps NaN to 1.0 (see the note on arm_nn_sigmoid_scalar_f32 in arm_nnsupportfunctions_flt.h). NaN payloads and signs are not preserved on the MVE leg (default NaN, architectural). Inf follows the arithmetic.

Parameters:
  • input[in] Input sequence tensor. Must not overlap output: earlier outputs are re-read as the recurrent state for later time steps, so aliasing corrupts silently.

  • output[out] Output (hidden-state) sequence tensor.

  • params[in] Struct describing the GRU operator.

  • buffers[inout] Scratch buffers. May be NULL when reset_after != 0. temp1 is sized by arm_gru_unidirectional_f16_temp1_get_buffer_size().

Returns:

ARM_CMSIS_NN_SUCCESS on success, ARM_CMSIS_NN_ARG_ERROR otherwise.