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 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
taugrucell(inp, state)
taugrucell(inp)Arguments
inp: The input to the taugrucell. It should be a vector of sizeinput_sizeor a matrix of sizeinput_size x batch_size.state: A tuple(hidden_state, history). The hidden state should be a vector of sizehidden_sizeor a matrix of sizehidden_size x batch_size. The history is a flattened delay buffer of sizehidden_size * delayorhidden_size * delay x batch_size. If not provided, both are initialized to zeros byFlux.initialstates.
Returns
- A tuple
(output, state), whereoutput = new_stateis the new hidden state andstate = (new_state, new_history)is the new hidden state together with the shifted delay buffer.