Skip to content
Permalink
Browse files

Merge 640ea0d into cc0f376

  • Loading branch information...
muupan committed Aug 25, 2019
2 parents cc0f376 + 640ea0d commit b23ada94cdaed197c6b7b28916d6d34ec904e008
Showing with 2 additions and 2 deletions.
  1. +2 −2 chainerrl/agents/reinforce.py
@@ -140,7 +140,7 @@ def stop_episode_and_train(self, obs, reward, done=False):

def accumulate_grad(self):
if self.n_backward == 0:
self.model.zerograds()
self.model.cleargrads()
# Compute losses
losses = []
for r_seq, log_prob_seq, ent_seq in zip(self.reward_sequences,
@@ -168,7 +168,7 @@ def batch_update(self):
assert len(self.log_prob_sequences) == self.batchsize
assert len(self.entropy_sequences) == self.batchsize
# Update the model
self.model.zerograds()
assert self.n_backward == 0
self.accumulate_grad()
self.optimizer.update()
self.n_backward = 0

0 comments on commit b23ada9

Please sign in to comment.
You can’t perform that action at this time.