MCPcopy Index your code
hub / github.com/pytorch/tutorials / td_target

Method td_target

intermediate_source/mario_rl_tutorial.py:507–513  ·  view source on GitHub ↗
(self, reward, next_state, done)

Source from the content-addressed store, hash-verified

505
506 @torch.no_grad()
507 def td_target(self, reward, next_state, done):
508 next_state_Q = self.net(next_state, model="online")
509 best_action = torch.argmax(next_state_Q, axis=1)
510 next_Q = self.net(next_state, model="target")[
511 np.arange(0, self.batch_size), best_action
512 ]
513 return (reward + (1 - done.float()) * self.gamma * next_Q).float()
514
515
516######################################################################

Callers 1

learnMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected