UnICORNNCell

LuxRecurrentLayers.UnICORNNCellType
UnICORNNCell(in_dims => out_dims;
    use_bias=true, use_recurrent_bias=true,
    train_state=false, train_memory=false,
    init_bias=nothing, init_recurrent_bias=nothing,
    init_weight=nothing, init_recurrent_weight=nothing,
    init_state=zeros32, init_memory=zeros32,
    dt=1.0, alpha=0.0)

Undamped independent controlled oscillatory recurrent neural unit.

Equations

\[\begin{aligned} \mathbf{h}(t) &= \mathbf{h}(t-1) + \Delta t \cdot \hat{\sigma}(\mathbf{w}_{ch}) \circ \mathbf{z}(t), \\ \mathbf{z}(t) &= \mathbf{z}(t-1) - \Delta t \cdot \hat{\sigma}(\mathbf{w}_{ch}) \circ \left[ \sigma \left( \mathbf{w}_{hh} \circ \mathbf{h}(t-1) + \mathbf{W}_{ih} \mathbf{x}(t) + \mathbf{b}_{ih} \right) + \alpha \cdot \mathbf{h}(t-1) \right]. \end{aligned}\]

Arguments

  • in_dims: Input Dimension
  • out_dims: Output (Hidden State & Memory) Dimension

Keyword Arguments

  • use_bias: Flag to use bias $\mathbf{b}_{ih}$ in the computation. Default set to true.
  • use_recurrent_bias: Flag to use recurrent bias $\mathbf{b}_{hh}$ in the computation. Default set to true.
  • train_state: Flag to set the initial hidden state as trainable. Default set to false.
  • train_memory: Flag to set the initial memory state as trainable. Default set to false.
  • init_bias: Initializer for input bias $\mathbf{b}_{ih}$. Must be a single function. If set to nothing, the bias is initialized from a uniform distribution within [-bound, bound], where bound = inv(sqrt(out_dims)). Default set to nothing.
  • init_weight: Initializer for input weight $\mathbf{W}_{ih}$. Must be a single function. If set to nothing, the weight is initialized from a uniform distribution within [-bound, bound], where bound = inv(sqrt(out_dims)). Default set to nothing.
  • init_recurrent_weight: Initializer for recurrent weight $\mathbf{w}_{hh}$. Must be a single function. If set to nothing, the weight is initialized from a uniform distribution within [-bound, bound], where bound = inv(sqrt(out_dims)). Default set to nothing.
  • init_control_weight: Initializer for control weight $\mathbf{w}_{ch}$. Must be a single function. If set to nothing, the weight is initialized from a uniform distribution within [-bound, bound], where bound = inv(sqrt(out_dims)). Default set to nothing.
  • init_state: Initializer for hidden state. Default set to zeros32.
  • init_memory: Initializer for memory. Default set to zeros32.

Inputs

  • Case 1a: Only a single input x of shape (in_dims, batch_size), train_state is set to false, train_memory is set to false - Creates a hidden state using init_state, hidden memory using init_memory and proceeds to Case 2.
  • Case 1b: Only a single input x of shape (in_dims, batch_size), train_state is set to true, train_memory is set to false - Repeats hidden_state vector from the parameters to match the shape of x, creates hidden memory using init_memory and proceeds to Case 2.
  • Case 1c: Only a single input x of shape (in_dims, batch_size), train_state is set to false, train_memory is set to true - Creates a hidden state using init_state, repeats the memory vector from parameters to match the shape of x and proceeds to Case 2.
  • Case 1d: Only a single input x of shape (in_dims, batch_size), train_state is set to true, train_memory is set to true - Repeats the hidden state and memory vectors from the parameters to match the shape of x and proceeds to Case 2.
  • Case 2: Tuple (x, (h, c)) is provided, then the output and a tuple containing the updated hidden state and memory is returned.

Returns

  • Tuple Containing

    • Output $h_{new}$ of shape (out_dims, batch_size)
    • Tuple containing new hidden state $h_{new}$ and new memory $c_{new}$
  • Updated model state

Parameters

  • weight_ih: Input-to-hidden weight $\{ \mathbf{W}_{ih} \}$
  • weight_hh: Elementwise recurrent weight $\{ \mathbf{w}_{hh} \}$
  • weight_ch: Elementwise control weight $\{ \mathbf{w}_{ch} \}$
  • bias_ih: Input-to-hidden bias (not present if use_bias=false) $\{ \mathbf{b}_{ih} \}$
  • hidden_state: Initial hidden state vector (not present if train_state=false)
  • memory: Initial memory vector (not present if train_memory=false)

States

  • rng: Controls the randomness (if any) in the initial state generation
source