class_docstr: 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).
class_docstr_tok: ["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",")","."]
docstr: Get actions given observations.
  
  Args:
      observations (np.ndarray): Observations from the environment.
  
  Returns:
      tuple:
          * np.ndarray: Predicted actions.
          * dict:
              * np.ndarray[float]: Mean of the distribution
              * np.ndarray[float]: Log of standard deviation of the
                  distribution
docstr_tok: ["Get","actions","given","observations",".","Args",":","observations","(","np.ndarray",")",":","Observations","from","the","environment",".","Returns",":","tuple",":","*","np.ndarray",":","Predicted","actions",".","*","dict",":","*","np.ndarray","[","float","]",":","Mean","of","the","distribution","*","np.ndarray","[","float","]",":","Log","of","standard","deviation","of","the","distribution"]
code: def get_actions(self, observations):
      """Get actions given observations.
  
      Args:
          observations (np.ndarray): Observations from the environment.
  
      Returns:
          tuple:
              * np.ndarray: Predicted actions.
              * dict:
                  * np.ndarray[float]: Mean of the distribution
                  * np.ndarray[float]: Log of standard deviation of the
                      distribution
      """
      if not isinstance(observations[0], np.ndarray) and not isinstance(
          observations[0], torch.Tensor
      ):
          observations = self._env_spec.observation_space.flatten_n(
              observations
          )
  
      # frequently users like to pass lists of torch tensors or lists of
      # numpy arrays. This handles those conversions.
      if isinstance(observations, list):
          if isinstance(observations[0], np.ndarray):
              observations = np.stack(observations)
          elif isinstance(observations[0], torch.Tensor):
              observations = torch.stack(observations)
  
      if (
          isinstance(observations[0], np.ndarray)
          and len(observations[0].shape) > 1
      ):
          observations = self._env_spec.observation_space.flatten_n(
              observations
          )
      elif (
          isinstance(observations[0], torch.Tensor)
          and len(observations[0].shape) > 1
      ):
          observations = torch.flatten(observations, start_dim=1)
  
      if isinstance(
          self._env_spec.observation_space, akro.Image
      ) and len(observations.shape) < len(
          self._env_spec.observation_space.shape
      ):
          observations = self._env_spec.observation_space.unflatten_n(
              observations
          )
      with torch.no_grad():
          x = self(torch.Tensor(observations).to(global_device()))
          return x.cpu().numpy(), dict()
  
file_path: garage/src/garage/torch/policies/deterministic_mlp_policy.py
imports: import akro
  import numpy
  import torch
  from garage.torch import global_device
  from garage.torch.modules import MLPModule
  from garage.torch.policies.policy import Policy
label_desc: Use image node_id 4 for calling the DeterministicMLPPolicy obj's underlying member method code with example usage: obj.get_actions(observations) and returns: x,  dict