TauGRUCell

RecurrentLayers.TauGRUCell — Type
TauGRUCell(input_size => hidden_size;
    delay = 1,
    init_kernel = glorot_uniform,
    init_recurrent_kernel = glorot_uniform,
    bias = true, recurrent_bias = true,
    independent_recurrence = false, integration_mode = :addition)

Gated recurrent unit with weighted time-delay feedback (Erichson et al., 2025). See TauGRU for a layer that processes entire sequences.

Arguments

  • input_size => hidden_size: input and inner dimension of the layer.

Keyword arguments

  • delay: positive integer recurrent delay. Default is 1.
  • init_kernel: initializer for the input to hidden weights. Default is glorot_uniform.
  • init_recurrent_kernel: initializer for the hidden to hidden weights. Default is glorot_uniform.
  • bias: include input to recurrent bias or not. Default is true.
  • recurrent_bias: include recurrent to recurrent bias or not. Default is true.
  • independent_recurrence: flag to toggle independent recurrence. If true, the recurrent to recurrent weights are a vector instead of a matrix. Default false.
  • integration_mode: determines how the input and hidden projections are combined. The options are :addition and :multiplicative_integration. Defaults to :addition.

Equations

\[\begin{aligned} \mathbf{u}_n &= \tanh\left( \mathbf{W}_1 \mathbf{h}_n + \mathbf{U}_1 \mathbf{x}_n \right), \\ \mathbf{z}_n &= \tanh\left( \mathbf{W}_2 \mathbf{h}_{n-d} + \mathbf{U}_2 \mathbf{x}_n \right), \\ \mathbf{g}_n &= \sigma\left( \mathbf{W}_3 \mathbf{h}_n + \mathbf{U}_3 \mathbf{x}_n \right), \\ \mathbf{a}_n &= \sigma\left( \mathbf{W}_4 \mathbf{h}_n + \mathbf{U}_4 \mathbf{x}_n \right), \\ \mathbf{h}_{n+1} &= \left(1 - \mathbf{g}_n\right) \odot \mathbf{h}_n + \mathbf{g}_n \odot \left(\mathbf{u}_n + \mathbf{a}_n \odot \mathbf{z}_n\right) \end{aligned}\]

Forward

taugrucell(inp, state)
taugrucell(inp)

Arguments

  • inp: The input to the taugrucell. It should be a vector of size input_size or a matrix of size input_size x batch_size.
  • state: A tuple (hidden_state, history). The hidden state should be a vector of size hidden_size or a matrix of size hidden_size x batch_size. The history is a flattened delay buffer of size hidden_size * delay or hidden_size * delay x batch_size. If not provided, both are initialized to zeros by Flux.initialstates.

Returns

  • A tuple (output, state), where output = new_state is the new hidden state and state = (new_state, new_history) is the new hidden state together with the shifted delay buffer.
source