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 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.

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 size input_size or a matrix of size input_size x batch_size.
  • (vstate, cstate): A tuple containing the control vector and cell states of the MCLSTMCell. 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_vstate, new_cstate) is the new control vector and cell state. They are tensors of size hidden_size or hidden_size x batch_size.
source