Skip to content

Commit

Permalink
Tutorial Fixes
Browse files Browse the repository at this point in the history
1. `time_step` needs to be reset after each episode.
2. `next_time_step` should be `time_step` for collecting rewards.
  • Loading branch information
jackdreilly committed Aug 28, 2019
1 parent a614c5b commit 7044707
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tf_agents/colabs/2_environments_tutorial.ipynb
Expand Up @@ -708,9 +708,10 @@
" action = tf.random_uniform([1], 0, 2, dtype=tf.int32)\n",
" time_step = tf_env.step(action)\n",
" episode_steps += 1\n",
" episode_reward += next_time_step.reward.numpy()\n",
" episode_reward += time_step.reward.numpy()\n",
" rewards.append(episode_reward)\n",
" steps.append(episode_steps)\n",
" time_step = tf_env.reset()\n",
"\n",
"num_steps = np.sum(steps)\n",
"avg_length = np.mean(steps)\n",
Expand Down

0 comments on commit 7044707

Please sign in to comment.