LSTM

class ivy.stateful.layers.LSTM(input_channels, output_channels, /, *, weight_initializer=<ivy.stateful.initializers.GlorotUniform object>, num_layers=1, return_sequence=True, return_state=True, device=None, v=None, dtype=None)[source]

Bases: Module

__init__(input_channels, output_channels, /, *, weight_initializer=<ivy.stateful.initializers.GlorotUniform object>, num_layers=1, return_sequence=True, return_state=True, device=None, v=None, dtype=None)[source]

LSTM layer, which is a set of stacked lstm cells.

Parameters
  • input_channels – Number of input channels for the layer

  • output_channels – Number of output channels for the layer

  • weight_initializer – Initializer for the weights. Default is GlorotUniform.

  • num_layers – Number of lstm cells in the lstm layer, default is 1.

  • return_sequence – Whether or not to return the entire output sequence, or just the latest timestep. Default is True.

  • return_state – Whether or not to return the latest hidden and cell states. Default is True.

  • device – device on which to create the layer’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. Default is cpu.

  • v – the variables for each of the lstm cells, as a container, constructed internally by default.

  • dtype

    the desired data type of the internal variables to be created if not

    provided. Default is None.

get_initial_state(batch_shape, dtype=None)[source]

Get the initial state of the hidden and cell states, if not provided explicitly

Parameters
  • batch_shape

  • dtype

    the desired data type of the internal variables to be created if not

    provided. Default is None.


Supported Frameworks: