class_docstr: Agent.
  Args:
      algorithm (`parl.Algorithm`): algorithm to be used in this agent.
class_docstr_tok: ["Agent",".","Args",":","algorithm","(","`","parl.Algorithm","`",")",":","algorithm","to","be","used","in","this","agent","."]
docstr: Sampling action
  Args:
      state (np.array): representation of current state 
  Return:
      action (np.array): action to be executed
docstr_tok: ["Sampling","action","Args",":","state","(","np.array",")",":","representation","of","current","state","Return",":","action","(","np.array",")",":","action","to","be","executed"]
code: def sample(self, state):
      """Sampling action
      Args:
          state (np.array): representation of current state
      Return:
          action (np.array): action to be executed
      """
  
      state_tensor = torch.tensor(state, dtype=torch.float32)
  
      with torch.no_grad():
          value, action, action_log_prob = self.alg.sample(state_tensor)
  
      value = value.detach().cpu().numpy().flatten()
      action = action.detach().cpu().numpy()
      action_log_prob = action_log_prob.detach().cpu().numpy()
  
      return value, action, action_log_prob
  
file_path: PARL/examples/Baselines/Halite_competition/torch/rl_trainer/agent.py
imports: import os
  import parl
  import torch
label_desc: Use image node_id 4 for calling the Agent obj's underlying member method code with example usage: obj.sample(state) and returns: value,  action,  action_log_prob