LSTM

class dragon.nn.LSTM(
  input_size,
  hidden_size,
  num_layers=1,
  bidirectional=False,
  dropout=0,
  **kwargs
)[source]

Apply a multi-layer long short-term memory (LSTM) RNN. [Hochreiter & Schmidhuber, 1997].

The data format of inputs should be \((T, N, C)\):

t, n, c = 8, 2, 4
m = dragon.nn.LSTM(8, 16)
x = dragon.constant([t, n, c], 'float32')
y = m(x)

__init__

LSTM.__init__(
  input_size,
  hidden_size,
  num_layers=1,
  bidirectional=False,
  dropout=0,
  **kwargs
)[source]

Create a LSTM module.

Parameters:
  • input_size (int) – The dimension of input.
  • hidden_size (int) – The dimension of hidden state.
  • num_layers (int, optional, default=1) – The number of recurrent layers.
  • bidirectional (bool, optional, default=False) – Whether to create a bidirectional lstm.
  • dropout (number, optional, default=0) – The dropout ratio.