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 isfalse.delay: positive integer recurrent delay. Default is1.init_kernel: initializer for the input to hidden weights. Default isglorot_uniform.init_recurrent_kernel: initializer for the hidden to hidden weights. Default isglorot_uniform.bias: include input to recurrent bias or not. Default istrue.recurrent_bias: include recurrent to recurrent bias or not. Default istrue.independent_recurrence: flag to toggle independent recurrence. Iftrue, the recurrent to recurrent weights are a vector instead of a matrix. Defaultfalse.integration_mode: determines how the input and hidden projections are combined. The options are:additionand: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 sizeinput_size x lenor a matrix of sizeinput_size x len x batch_size.state: A tuple(hidden_state, history). If not provided, both are initialized to zeros byFlux.initialstates.
Returns
- New hidden states
new_statesas an array of sizehidden_size x len x batch_size. Whenreturn_state = trueit returns a tuple of the hidden statesnew_statesand the last state of the iteration.