garage.tf.models.lstm

LSTM in TensorFlow.

lstm(name, lstm_cell, all_input_var, step_input_var, step_hidden_var, step_cell_var, output_nonlinearity_layer, hidden_state_init=tf.zeros_initializer(), hidden_state_init_trainable=False, cell_state_init=tf.zeros_initializer(), cell_state_init_trainable=False)

Long Short-Term Memory (LSTM).

Parameters
  • name (str) – Name of the variable scope.

  • lstm_cell (tf.keras.layers.Layer) – LSTM cell used to generate outputs.

  • all_input_var (tf.Tensor) – Place holder for entire time-seried inputs, with shape \((N, T, S^*)\).

  • step_input_var (tf.Tensor) – Place holder for step inputs, with shape \((N, S^*)\).

  • step_hidden_var (tf.Tensor) – Place holder for step hidden state, with shape \((N, H)\).

  • step_cell_var (tf.Tensor) – Place holder for cell state, with shape \((N, H)\).

  • output_nonlinearity_layer (callable) – Activation function for output dense layer. It should return a tf.Tensor. Set it to None to maintain a linear activation.

  • hidden_state_init (callable) – Initializer function for the initial hidden state. The functino should return a tf.Tensor.

  • hidden_state_init_trainable (bool) – Bool for whether the initial hidden state is trainable.

  • cell_state_init (callable) – Initializer function for the initial cell state. The functino should return a tf.Tensor.

  • cell_state_init_trainable (bool) – Bool for whether the initial cell state is trainable.

Returns

Entire time-seried outputs, with shape \((N, T, S^*)\). tf.Tensor: Step output, with shape \((N, S^*)\). tf.Tensor: Step hidden state, with shape \((N, H)\). tf.Tensor: Step cell state, with shape \((N, H)\). tf.Tensor: Initial hidden state, with shape \((H, )\). tf.Tensor: Initial cell state, with shape \((H, )\).

Return type

tf.Tensor