garage.tf.models.gru module

GRU in TensorFlow.

gru(name, gru_cell, all_input_var, step_input_var, step_hidden_var, output_nonlinearity_layer, hidden_state_init=<tensorflow.python.ops.init_ops.Zeros object>, hidden_state_init_trainable=False)[source]

Gated Recurrent Unit (GRU).

Parameters:
  • name (str) – Name of the variable scope.
  • gru_cell (tf.keras.layers.Layer) – GRU cell used to generate outputs.
  • all_input_var (tf.Tensor) – Place holder for entire time-series inputs.
  • step_input_var (tf.Tensor) – Place holder for step inputs.
  • step_hidden_var (tf.Tensor) – Place holder for step hidden state.
  • 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.
Returns:

Entire time-series outputs. output (tf.Tensor): Step output. hidden (tf.Tensor): Step hidden state. hidden_init_var (tf.Tensor): Initial hidden state.

Return type:

outputs (tf.Tensor)