code: def update(self, value):
      
      with tf.name_scope(self._name + '/update'):
        if value.shape.ndims == self._mean.shape.ndims:
          # Add a batch dimension if necessary.
          value = value[None, ...]
        count = tf.shape(value)[0]
        with tf.control_dependencies([self._count.assign_add(count)]):
          step = tf.cast(self._count, tf.float32)
          mean_delta = tf.reduce_sum(value - self._mean[None, ...], 0)
          new_mean = self._mean + mean_delta / step
          new_mean = tf.cond(self._count > 1, lambda: new_mean, lambda: value[0])
          var_delta = (
              value - self._mean[None, ...]) * (value - new_mean[None, ...])
          new_var_sum = self._var_sum + tf.reduce_sum(var_delta, 0)
        with tf.control_dependencies([new_mean, new_var_sum]):
          update = self._mean.assign(new_mean), self._var_sum.assign(new_var_sum)
        with tf.control_dependencies(update):
          if value.shape.ndims == 1:
            value = tf.reduce_mean(value)
          return self._summary('value', tf.reduce_mean(value))
docs: Update the mean and variance estimates.
  
      Args:
        value: Batch or single value tensor.
  
      Returns:
        Summary tensor.