Skip to content

Commit

Permalink
Merge pull request #528 from muupan/fix-batch-recurrent-experiences-n…
Browse files Browse the repository at this point in the history
…ext-action-error

Fix a bug in `batch_recurrent_experiences` regarding next_action
  • Loading branch information
prabhatnagarajan committed Aug 26, 2019
2 parents cc0f376 + 4340a9c commit 9b2f58f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chainerrl/replay_buffer.py
Expand Up @@ -228,7 +228,9 @@ def batch_recurrent_experiences(
'next_recurrent_state': model.concatenate_recurrent_states(
[ep[0]['next_recurrent_state'] for ep in experiences]),
}
if all(elem[-1]['next_action'] is not None for elem in experiences):
# Batch next actions only when all the transitions have them
if all(transition['next_action'] is not None
for transition in flat_transitions):
batch_exp['next_action'] = xp.asarray(
[transition['next_action'] for transition in flat_transitions])
return batch_exp
Expand Down

0 comments on commit 9b2f58f

Please sign in to comment.