MCLSTMCell
RecurrentLayers.MCLSTMCell — Type
MCLSTMCell(input_size => hidden_size;
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true, recurrent_bias = true,
independent_recurrence = false, integration_mode = :addition)Memory controller long short term memory cell (Ben-Ari and Shwartz-Ziv, 2017). See MCLSTM 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 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{align} \mathbf{f}_t &= \sigma\left( \mathbf{W}_{fv} \mathbf{v}_{t-1} + \mathbf{W}_{fx} \mathbf{x}_t + \mathbf{b}_f \right), \\ \mathbf{i}_t &= \sigma\left( \mathbf{W}_{iv} \mathbf{v}_{t-1} + \mathbf{W}_{ix} \mathbf{x}_t + \mathbf{b}_i \right), \\ \mathbf{o}_t &= \sigma\left( \mathbf{W}_{ov} \mathbf{v}_{t-1} + \mathbf{W}_{ox} \mathbf{x}_t + \mathbf{b}_o \right), \\ \mathbf{m}_t &= \sigma\left( \mathbf{W}_{mv} \mathbf{v}_{t-1} + \mathbf{W}_{mx} \mathbf{x}_t + \mathbf{b}_m \right), \\ \mathbf{n}_t &= \tanh\left( \mathbf{W}_{nv} \mathbf{v}_{t-1} + \mathbf{W}_{nx} \mathbf{x}_t + \mathbf{b}_n \right), \\ \mathbf{c}_t &= \mathbf{f}_t \circ \mathbf{c}_{t-1} + \mathbf{i}_t \circ \mathbf{n}_t, \\ \mathbf{h}_t &= \mathbf{o}_t \circ \tanh(\mathbf{c}_t), \\ \mathbf{v}_t &= \mathbf{m}_t \circ \tanh(\mathbf{c}_t). \end{align}\]
Forward
mclstmcell(inp, (vstate, cstate))
mclstmcell(inp)Arguments
inp: The input to the mclstmcell. It should be a vector of sizeinput_sizeor a matrix of sizeinput_size x batch_size.(vstate, cstate): A tuple containing the control vector and cell states of the MCLSTMCell. They should be vectors of sizehidden_sizeor matrices of sizehidden_size x batch_size. If not provided, they are assumed to be vectors of zeros, initialized byFlux.initialstates.
Returns
- A tuple
(output, state), whereoutput = new_stateis the new hidden state andstate = (new_vstate, new_cstate)is the new control vector and cell state. They are tensors of sizehidden_sizeorhidden_size x batch_size.