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

Method update_Q_online

intermediate_source/mario_rl_tutorial.py:548–553  ·  view source on GitHub ↗
(self, td_estimate, td_target)

Source from the content-addressed store, hash-verified

546 self.loss_fn = torch.nn.SmoothL1Loss()
547
548 def update_Q_online(self, td_estimate, td_target):
549 loss = self.loss_fn(td_estimate, td_target)
550 self.optimizer.zero_grad()
551 loss.backward()
552 self.optimizer.step()
553 return loss.item()
554
555 def sync_Q_target(self):
556 self.net.target.load_state_dict(self.net.online.state_dict())

Callers 1

learnMethod · 0.95

Calls 2

stepMethod · 0.80
backwardMethod · 0.45

Tested by

no test coverage detected