GRUUnit - 1#


  • name: GRUUnit (GitHub)

  • domain: main

  • since_version: 1

  • function:

  • support_level:

  • shape inference:

This version of the operator has been available since version 1.


GRUUnit computes the activations of a standard GRU, in a sequence-length aware fashion. Concretely, given the (fused) inputs X (TxNxD), the previous hidden state (NxD), and the sequence lengths (N), computes the GRU activations, avoiding computation if the input is invalid (as in, the value at X[t][n] >= seqLengths[n].


  • drop_states: Bool to determine if hidden state is zeroes or passed along for timesteps past the given sequence_length. Default value is ?.


  • hidden_prev (heterogeneous) - T: The previous GRU hidden state.

  • gates (heterogeneous) - T: Unactivated gate outputs from forget, update, and output gates, pre- activation.

  • seq_lengths (heterogeneous) - T: Array of sequence lengths. len(seq_lengths) should equal batch size N.

  • t (heterogeneous) - T: The timestep for this operation.


  • hidden (heterogeneous) - T: The new GRU hidden state calculated by this op.