garage.torch.policies.deterministic_mlp_policy module

This modules creates a deterministic policy network.

A neural network can be used as policy method in different RL algorithms. It accepts an observation of the environment and predicts an action.

class DeterministicMLPPolicy(env_spec, name='DeterministicMLPPolicy', **kwargs)[source]

Bases: garage.torch.policies.policy.Policy

Implements a deterministic policy network.

The policy network selects action based on the state of the environment. It uses a PyTorch neural network module to fit the function of pi(s).

forward(observations)[source]

Compute actions from the observations.

Parameters:observations (torch.Tensor) – Batch of observations on default torch device.
Returns:Batch of actions.
Return type:torch.Tensor
get_action(observation)[source]

Get a single action given an observation.

Parameters:observation (np.ndarray) – Observation from the environment.
Returns:
  • np.ndarray: Predicted action.
  • dict:
    • list[float]: Mean of the distribution
    • list[float]: Log of standard deviation of the
      distribution
Return type:tuple
get_actions(observations)[source]

Get actions given observations.

Parameters:observations (np.ndarray) – Observations from the environment.
Returns:
  • np.ndarray: Predicted actions.
  • dict:
    • list[float]: Mean of the distribution
    • list[float]: Log of standard deviation of the
      distribution
Return type:tuple