[tune] Fix default handling for timesteps (#3293)

This PR fixes an issue where previously if timesteps_this_iter = 0,
then it would render as "None".

Closes #3057.
This commit is contained in:
Richard Liaw
2018-11-12 15:52:17 -08:00
committed by GitHub
parent 49e2085d78
commit e37891d79d
2 changed files with 23 additions and 7 deletions
+3 -3
View File
@@ -161,14 +161,14 @@ class Trainable(object):
result.setdefault(DONE, False)
# self._timesteps_total should only be tracked if increments provided
if result.get(TIMESTEPS_THIS_ITER):
if result.get(TIMESTEPS_THIS_ITER) is not None:
if self._timesteps_total is None:
self._timesteps_total = 0
self._timesteps_total += result[TIMESTEPS_THIS_ITER]
self._timesteps_since_restore += result[TIMESTEPS_THIS_ITER]
# self._timesteps_total should only be tracked if increments provided
if result.get(EPISODES_THIS_ITER):
# self._episodes_total should only be tracked if increments provided
if result.get(EPISODES_THIS_ITER) is not None:
if self._episodes_total is None:
self._episodes_total = 0
self._episodes_total += result[EPISODES_THIS_ITER]