[rllib][tune] fix some nans (#7611)

This commit is contained in:
Eric Liang
2020-03-16 11:19:58 -07:00
committed by GitHub
parent 46953c53b1
commit 797e6cfc2a
3 changed files with 14 additions and 6 deletions
+7 -3
View File
@@ -48,15 +48,19 @@ class _Timer:
@property
def mean(self):
return np.mean(self._samples)
if not self._samples:
return 0.0
return float(np.mean(self._samples))
@property
def mean_units_processed(self):
if not self._units_processed:
return 0.0
return float(np.mean(self._units_processed))
@property
def mean_throughput(self):
time_total = sum(self._samples)
time_total = float(sum(self._samples))
if not time_total:
return 0.0
return sum(self._units_processed) / time_total
return float(sum(self._units_processed)) / time_total