MCPcopy Create free account
hub / github.com/pytorch/examples / select_action

Method select_action

distributed/rpc/batch/reinforce.py:173–182  ·  view source on GitHub ↗

r""" Non-batching select_action, return the action right away.

(agent_rref, ob_id, state)

Source from the content-addressed store, hash-verified

171
172 @staticmethod
173 def select_action(agent_rref, ob_id, state):
174 r"""
175 Non-batching select_action, return the action right away.
176 """
177 self = agent_rref.local_value()
178 probs = self.policy(state.cuda())
179 m = Categorical(probs)
180 action = m.sample()
181 self.saved_log_probs[ob_id].append(m.log_prob(action))
182 return action.item()
183
184 def run_episode(self, n_steps=0):
185 r"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected