garage.tf.models.parameter module

Parameter layer in TensorFlow.

parameter(input_var, length, initializer=<tensorflow.python.ops.init_ops.Zeros object>, dtype=tf.float32, trainable=True, name='parameter')[source]

Parameter layer.

Used as layer that could be broadcast to a certain shape to match with input variable during training.

For recurrent usage, use garage.tf.models.recurrent_parameter().

Example: A trainable parameter variable with shape (2,), it needs to be broadcasted to (32, 2) when applied to a batch with size 32.

Parameters:
  • input_var (tf.Tensor) – Input tf.Tensor.
  • length (int) – Integer dimension of the variable.
  • initializer (callable) – Initializer of the variable. The function should return a tf.Tensor.
  • dtype – Data type of the variable (default is tf.float32).
  • trainable (bool) – Whether the variable is trainable.
  • name (str) – Variable scope of the variable.
Returns:

A tensor of the broadcasted variables.

recurrent_parameter(input_var, step_input_var, length, initializer=<tensorflow.python.ops.init_ops.Zeros object>, dtype=tf.float32, trainable=True, name='recurrent_parameter')[source]

Parameter layer for recurrent networks.

Used as layer that could be broadcast to a certain shape to match with input variable during training.

Example: A trainable parameter variable with shape (2,), it needs to be broadcasted to (32, 4, 2) when applied to a batch with size 32 and time-length 4.

Parameters:
  • input_var (tf.Tensor) – Input tf.Tensor for full time-series inputs.
  • step_input_var (tf.Tensor) – Input tf.Tensor for step inputs.
  • length (int) – Integer dimension of the variable.
  • initializer (callable) – Initializer of the variable. The function should return a tf.Tensor.
  • dtype – Data type of the variable (default is tf.float32).
  • trainable (bool) – Whether the variable is trainable.
  • name (str) – Variable scope of the variable.
Returns:

one for full time-series

inputs, one for step inputs.

Return type:

A tensor of the two broadcasted variables