class_docstr: TensorFlow variables-based implmentation of computing running mean and std
  Benefit of this implementation is that it can be saved / loaded together with the tensorflow model
class_docstr_tok: ["TensorFlow","variables-based","implmentation","of","computing","running","mean","and","std","Benefit","of","this","implementation","is","that","it","can","be","saved","\/","loaded","together","with","the","tensorflow","model"]
code: def __init__(self, epsilon=1e-4, shape=(), scope=""):
      sess = get_session()
  
      self._new_mean = tf.placeholder(shape=shape, dtype=tf.float64)
      self._new_var = tf.placeholder(shape=shape, dtype=tf.float64)
      self._new_count = tf.placeholder(shape=(), dtype=tf.float64)
  
      with tf.variable_scope(scope, reuse=tf.AUTO_REUSE):
          self._mean = tf.get_variable(
              "mean",
              initializer=np.zeros(shape, "float64"),
              dtype=tf.float64,
          )
          self._var = tf.get_variable(
              "std",
              initializer=np.ones(shape, "float64"),
              dtype=tf.float64,
          )
          self._count = tf.get_variable(
              "count",
              initializer=np.full((), epsilon, "float64"),
              dtype=tf.float64,
          )
  
      self.update_ops = tf.group(
          [
              self._var.assign(self._new_var),
              self._mean.assign(self._new_mean),
              self._count.assign(self._new_count),
          ]
      )
  
      sess.run(
          tf.variables_initializer([self._mean, self._var, self._count])
      )
      self.sess = sess
      self._set_mean_var_count()
  
file_path: baselines/baselines/common/running_mean_std.py
imports: import tensorflow
  import numpy
  from baselines.common.tf_util import get_session
label_desc: Use image node_id 1 to create a new TfRunningMeanStd object from inherited base classes: object with example: obj = TfRunningMeanStd(epsilon, shape, scope)