1
0
mirror of https://github.com/gryf/coach.git synced 2025-12-17 11:10:20 +01:00

Fix std calculation using unbiased estimation in sharing stat mode.

This commit is contained in:
cxx
2017-11-07 13:49:33 +08:00
committed by Itai Caspi
parent f47b8092af
commit 84e536d371

View File

@@ -40,8 +40,9 @@ class SharedRunningStats(object):
name="count", trainable=False) name="count", trainable=False)
self._shape = shape self._shape = shape
self._mean = tf.to_float(self._sum / self._count) self._mean = self._sum / self._count
self._std = tf.sqrt(tf.maximum(tf.to_float(self._sum_squared / self._count) - tf.square(self._mean), 1e-2)) self._std = tf.sqrt(tf.maximum((self._sum_squared - self._count*tf.square(self._mean))
/ tf.maximum(self._count-1, 1), epsilon))
self.new_sum = tf.placeholder(shape=self.shape, dtype=tf.float64, name='sum') self.new_sum = tf.placeholder(shape=self.shape, dtype=tf.float64, name='sum')
self.new_sum_squared = tf.placeholder(shape=self.shape, dtype=tf.float64, name='var') self.new_sum_squared = tf.placeholder(shape=self.shape, dtype=tf.float64, name='var')