From d34049cab46908614c46aba1a201bf772daffeb0 Mon Sep 17 00:00:00 2001 From: Xingdong Zuo Date: Tue, 18 Sep 2018 23:14:38 +0200 Subject: [PATCH] Update running_mean_std.py (#585) --- baselines/common/running_mean_std.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/baselines/common/running_mean_std.py b/baselines/common/running_mean_std.py index 443aa74..6b42e56 100644 --- a/baselines/common/running_mean_std.py +++ b/baselines/common/running_mean_std.py @@ -26,9 +26,9 @@ def update_mean_var_count_from_moments(mean, var, count, batch_mean, batch_var, new_mean = mean + delta * batch_count / tot_count m_a = var * count m_b = batch_var * batch_count - M2 = m_a + m_b + np.square(delta) * count * batch_count / (count + batch_count) - new_var = M2 / (count + batch_count) - new_count = batch_count + count + M2 = m_a + m_b + np.square(delta) * count * batch_count / tot_count + new_var = M2 / tot_count + new_count = tot_count return new_mean, new_var, new_count