Skip to content

Commit

Permalink
Attempt to fix Reinforce inf problem
Browse files Browse the repository at this point in the history
  • Loading branch information
masus04 committed Aug 18, 2018
1 parent 0ad4317 commit 7c1f72c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Othello/players/reinforcePlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def update(self):
policy_losses = [(-log_prob * reward) for log_prob, reward in zip(self.log_probs, rewards)]

self.optimizer.zero_grad()
policy_loss = torch.cat(policy_losses).sum()/len(policy_losses)
policy_loss = torch.mean(policy_losses)
policy_loss.backward()
self.optimizer.step()

Expand Down

0 comments on commit 7c1f72c

Please sign in to comment.