Skip to content

Commit

Permalink
Merge pull request #95 from muupan/dqn-stats-fix
Browse files Browse the repository at this point in the history
Update average_loss in update_from_episodes
  • Loading branch information
muupan authored May 22, 2017
2 parents 5475a5c + 8df075e commit 834fcac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chainerrl/agents/dqn.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ def update_from_episodes(self, episodes, errors_out=None):
for err, index in zip(errors_out_step, indices):
errors_out[index] += err
loss /= max_epi_len

# Update stats
self.average_loss *= self.average_loss_decay
self.average_loss += \
(1 - self.average_loss_decay) * float(loss.data)

self.optimizer.zero_grads()
loss.backward()
self.optimizer.update()
Expand Down

0 comments on commit 834fcac

Please sign in to comment.