TauGRU

RecurrentLayers.TauGRU — Type
TauGRU(input_size => hidden_size;
    return_state = false, kwargs...)

Gated recurrent unit with weighted time-delay feedback (Erichson et al., 2025). See TauGRUCell for a layer that processes a single sequence.

Arguments

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

Keyword arguments

  • return_state: Option to return the last state together with the output. Default is false.
  • 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

taugru(inp, state)
taugru(inp)

Arguments

  • inp: The input to the taugru. It should be a vector of size input_size x len or a matrix of size input_size x len x batch_size.
  • state: A tuple (hidden_state, history). If not provided, both are initialized to zeros by Flux.initialstates.

Returns

  • New hidden states new_states as an array of size hidden_size x len x batch_size. When return_state = true it returns a tuple of the hidden states new_states and the last state of the iteration.
source