TGRUCell
RecurrentLayers.TGRUCell
— TypeTGRUCell(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 isglorot_uniform
.init_recurrent_kernel
: initializer for the hidden to hidden weights. Default isglorot_uniform
.bias
: include a bias or not. Default istrue
.
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 sizeinput_size
or a matrix of sizeinput_size x batch_size
.state
: The hidden state of the TGRUCell. It should be a vector of sizehidden_size
or a matrix of sizehidden_size x batch_size
. If not provided, it is assumed to be a vector of zeros, initialized byFlux.initialstates
.
Returns
- A tuple
(output, state)
, whereoutput = new_state
is the new hidden state andstate = (new_state, inp)
is the new hidden state together with the current input. They are tensors of sizehidden_size
orhidden_size x batch_size
.
- Balduzzi2016Balduzzi, D. et al. Strongly-Typed Recurrent Neural Networks ICML 2016.