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 a single action given an observation.
  
  Args:
      observation (np.ndarray): Observation from the environment.
  
  Returns:
      tuple:
          * np.ndarray: Predicted action.
          * dict:
              * np.ndarray[float]: Mean of the distribution
              * np.ndarray[float]: Log of standard deviation of the
                  distribution
docstr_tok: ["Get","a","single","action","given","an","observation",".","Args",":","observation","(","np.ndarray",")",":","Observation","from","the","environment",".","Returns",":","tuple",":","*","np.ndarray",":","Predicted","action",".","*","dict",":","*","np.ndarray","[","float","]",":","Mean","of","the","distribution","*","np.ndarray","[","float","]",":","Log","of","standard","deviation","of","the","distribution"]
code: def get_action(self, observation):
      """Get a single action given an observation.
  
      Args:
          observation (np.ndarray): Observation from the environment.
  
      Returns:
          tuple:
              * np.ndarray: Predicted action.
              * dict:
                  * np.ndarray[float]: Mean of the distribution
                  * np.ndarray[float]: Log of standard deviation of the
                      distribution
      """
      if not isinstance(observation, np.ndarray) and not isinstance(
          observation, torch.Tensor
      ):
          observation = self._env_spec.observation_space.flatten(
              observation
          )
      elif (
          isinstance(observation, np.ndarray)
          and len(observation.shape) > 1
      ):
          observation = self._env_spec.observation_space.flatten(
              observation
          )
      elif (
          isinstance(observation, torch.Tensor)
          and len(observation.shape) > 1
      ):
          observation = torch.flatten(observation)
      with torch.no_grad():
          observation = torch.Tensor(observation).unsqueeze(0)
          action, agent_infos = self.get_actions(observation)
          return action[0], {k: v[0] for k, v in agent_infos.items()}
  
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 3 for calling the DeterministicMLPPolicy obj's underlying member method code with example usage: obj.get_action(observation) and returns: action,  unknown