docstr: This function is mostly borrowed from the Reinforcement Learning example.
  See https://github.com/pytorch/examples/tree/master/reinforcement_learning
  The main difference is that instead of keeping all probs in one list,
  the agent keeps probs in a dictionary, one key per observer.
  
  NB: no need to enforce thread-safety here as GIL will serialize
  executions.
docstr_tok: ["This","function","is","mostly","borrowed","from","the","Reinforcement","Learning","example",".","See","https",":","\/\/github.com\/pytorch\/examples\/tree\/master\/reinforcement_learning","The","main","difference","is","that","instead","of","keeping","all","probs","in","one","list",",","the","agent","keeps","probs","in","a","dictionary",",","one","key","per","observer",".","NB",":","no","need","to","enforce","thread-safety","here","as","GIL","will","serialize","executions","."]
code: def select_action(self, ob_id, state):
      r"""
      This function is mostly borrowed from the Reinforcement Learning example.
      See https://github.com/pytorch/examples/tree/master/reinforcement_learning
      The main difference is that instead of keeping all probs in one list,
      the agent keeps probs in a dictionary, one key per observer.
  
      NB: no need to enforce thread-safety here as GIL will serialize
      executions.
      """
      probs = self.policy(state.unsqueeze(0))
      m = Categorical(probs)
      action = m.sample()
      self.saved_log_probs[ob_id].append(m.log_prob(action))
      return action.item()
  
imports: import numpy
  from itertools import count
  import torch
  import torch.distributed.rpc
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from torch.distributed.rpc import RRef, rpc_sync, rpc_async, remote
  from torch.distributions import Categorical
  from torch.testing._internal.dist_utils import dist_init, worker_name
  from torch.testing._internal.distributed.rpc.rpc_agent_test_fixture import RpcAgentTestFixture
label_desc: Use image node_id 2 for calling the Agent obj's underlying member method code with example usage: obj.select_action(ob_id, state) and returns: action