MiRU2Cell

RecurrentLayers.MiRU2Cell — Type
MiRU2Cell(input_size => hidden_size, [activation];
    init_kernel = glorot_uniform,
    init_recurrent_kernel = glorot_uniform,
    bias = true, recurrent_bias = true,
    independent_recurrence = false, integration_mode = :addition,
    update_coefficient = 0.5, reset_coefficient = 0.5)

Minion gated recurrent unit 2 (Zyarah and Kudithipudi, 2026). See MiRU2 for a layer that processes entire sequences.

Arguments

  • input_size => hidden_size: input and inner dimension of the layer.
  • activation: activation function. Default tanh_fast.

Keyword arguments

  • 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.
  • update_coefficient: controls the dynamic update of the hidden states. Default is 0.5.
  • reset_coefficient: determines how much of the previous hidden state should be forgotten or reset before combining it with the new input. Default is 0.5.

Equations

\[\begin{aligned} \tilde{\mathbf{h}}(t) &= \tanh\!\left( \mathbf{W}_{h}\mathbf{x}(t) + \mathbf{b}_{h} + \mathbf{U}_{h}\!\left(\boldsymbol{\theta} \odot \mathbf{h}(t-1)\right) \right), \\ \mathbf{h}(t) &= \boldsymbol{\lambda} \odot \mathbf{h}(t-1) + \left(1 - \boldsymbol{\lambda}\right) \odot \tilde{\mathbf{h}}(t) \end{aligned}\]

Forward

mirucell(inp, (state, cstate))
mirucell(inp)

Arguments

  • inp: The input to the mirucell. It should be a vector of size input_size or a matrix of size input_size x batch_size.
  • (state, cstate): A tuple containing the hidden and cell states of the MiRUCell. They should be vectors of size hidden_size or matrices of size hidden_size x batch_size. If not provided, they are assumed to be vectors of zeros, initialized by Flux.initialstates.

Returns

  • A tuple (output, state), where output = new_state is the new hidden state and state = (new_state, new_cstate) is the new hidden and cell state. They are tensors of size hidden_size or hidden_size x batch_size.
source