Wrappers

RecurrentLayers.StackedRNNType
StackedRNN(rlayer, (input_size, hidden_size), args...;
    num_layers = 1, dropout = 0.0, kwargs...)

Constructs a stack of recurrent layers given the recurrent layer type.

Arguments:

  • rlayer: Any recurrent layer such as MGU, RHN, etc... or Flux.RNN, Flux.LSTM, etc.
  • input_size: Defines the input dimension for the first layer.
  • hidden_size: defines the dimension of the hidden layer.
  • num_layers: The number of layers to stack. Default is 1.
  • dropout: Value of dropout to apply between recurrent layers. Default is 0.0.
  • args...: Additional positional arguments passed to the recurrent layer.

Keyword arguments

  • kwargs...: Additional keyword arguments passed to the recurrent layers.

Examples

julia> using RecurrentLayers

julia> stac_rnn = StackedRNN(MGU, (3=>5); num_layers = 4)
StackedRNN(
  [
    MGU(3 => 10),                       # 90 parameters
    MGU(5 => 10),                       # 110 parameters
    MGU(5 => 10),                       # 110 parameters
    MGU(5 => 10),                       # 110 parameters
  ],
)         # Total: 12 trainable arrays, 420 parameters,
          # plus 4 non-trainable, 20 parameters, summarysize 2.711 KiB.
source