garage.tf.models.module module¶
Interface for primitives which build on top of models.
-
class
Module
(name)[source]¶ Bases:
abc.ABC
A module that builds on top of model.
Parameters: name (str) – Module name, also the variable scope. -
flat_to_params
(flattened_params)[source]¶ Unflatten tensors according to their respective shapes.
Parameters: flattened_params (np.ndarray) – A numpy array of flattened params. Returns: - A list of parameters reshaped to the
- shapes specified.
Return type: List[np.ndarray]
-
get_global_vars
()[source]¶ Get global variables.
Returns: - A list of global variables in the current
- variable scope.
Return type: List[tf.Variable]
-
get_param_shapes
()[source]¶ Get parameter shapes.
Returns: A list of variable shapes. Return type: List[tuple]
-
get_param_values
()[source]¶ Get param values.
Returns: - Values of the parameters evaluated in
- the current session
Return type: np.ndarray
-
get_params
()[source]¶ Get the trainable variables.
Returns: - A list of trainable variables in the current
- variable scope.
Return type: List[tf.Variable]
-
get_trainable_vars
()[source]¶ Get trainable variables.
Returns: - A list of trainable variables in the current
- variable scope.
Return type: List[tf.Variable]
-
reset
(do_resets=None)[source]¶ Reset the module.
This is effective only to recurrent modules. do_resets is effective only to vectoried modules.
For a vectorized modules, do_resets is an array of boolean indicating which internal states to be reset. The length of do_resets should be equal to the length of inputs.
Parameters: do_resets (numpy.ndarray) – Bool array indicating which states to be reset.
-
set_param_values
(param_values)[source]¶ Set param values.
Parameters: param_values (np.ndarray) – A numpy array of parameter values.
-
state_info_keys
¶ State info keys.
Returns: - keys for the information related to the module’s state
- when taking an input.
Return type: List[str]
-
-
class
StochasticModule
(name)[source]¶ Bases:
garage.tf.models.module.Module
Stochastic Module.
-
distribution
¶ Distribution.
-