TGRUCell

RecurrentLayers.TGRUCellType
TGRUCell(input_size => hidden_size;
    init_kernel = glorot_uniform,
    init_recurrent_kernel = glorot_uniform,
    bias = true)

Strongly typed gated recurrent unit [Balduzzi2016]. See TGRU for a layer that processes entire sequences.

Arguments

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

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 a bias or not. Default is true.

Equations

\[\begin{aligned} \mathbf{z}(t) &= \mathbf{W}^{z}_{ih} \mathbf{x}(t) + \mathbf{W}^{z}_{hh} \mathbf{x}(t-1) + \mathbf{b}^{z} \\ \mathbf{f}(t) &= \sigma\left( \mathbf{W}^{f}_{ih} \mathbf{x}(t) + \mathbf{W}^{f}_{hh} \mathbf{x}(t-1) + \mathbf{b}^{f} \right) \\ \mathbf{o}(t) &= \tau\left( \mathbf{W}^{o}_{ih} \mathbf{x}(t) + \mathbf{W}^{o}_{hh} \mathbf{x}(t-1) + \mathbf{b}^{o} \right) \\ \mathbf{h}(t) &= \mathbf{f}(t) \odot \mathbf{h}(t-1) + \mathbf{z}(t) \odot \mathbf{o}(t) \end{aligned}\]

Forward

tgrucell(inp, state)
tgrucell(inp)

Arguments

  • inp: The input to the tgrucell. It should be a vector of size input_size or a matrix of size input_size x batch_size.
  • state: The hidden state of the TGRUCell. It should be a vector of size hidden_size or a matrix of size hidden_size x batch_size. If not provided, it is assumed to be a vector of zeros, initialized by Flux.initialstates.

Returns

  • A tuple (output, state), where output = new_state is the new hidden state and state = (new_state, inp) is the new hidden state together with the current input. They are tensors of size hidden_size or hidden_size x batch_size.
source
  • Balduzzi2016Balduzzi, D. et al. Strongly-Typed Recurrent Neural Networks ICML 2016.