class_docstr: A running variance computation.
  
  This is just an alias for `RunningCovariance`, with the `event_ndims` set to 0
  to compute variances.
  
  `RunningVariance` is meant to serve general streaming variance needs.
  For a specialized version that fits streaming over MCMC samples, see
  `VarianceReducer` in `tfp.experimental.mcmc`.
docstr: Initialize a `RunningVariance` object with given stats.
  
  This allows the user to initialize knowing the mean, variance, and number
  of samples seen so far.
  
  Args:
    num_samples: Scalar `float` `Tensor`, for number of examples already seen.
    mean: `float` `Tensor`, for starting mean of estimate.
    variance: `float` `Tensor`, for starting estimate of the variance.
  
  Returns:
    `RunningVariance` object, with given mean and variance estimate.
docstr_tok: ["Initialize","a","`","RunningVariance","`","object","with","given","stats",".","This","allows","the","user","to","initialize","knowing","the","mean",",","variance",",","and","number","of","samples","seen","so","far",".","Args",":","num_samples",":","Scalar","`","float","`","`","Tensor","`",",","for","number","of","examples","already","seen",".","mean",":","`","float","`","`","Tensor","`",",","for","starting","mean","of","estimate",".","variance",":","`","float","`","`","Tensor","`",",","for","starting","estimate","of","the","variance",".","Returns",":","`","RunningVariance","`","object",",","with","given","mean","and","variance","estimate","."]
code: def from_stats(cls, num_samples, mean, variance):
      """Initialize a `RunningVariance` object with given stats.
  
      This allows the user to initialize knowing the mean, variance, and number
      of samples seen so far.
  
      Args:
        num_samples: Scalar `float` `Tensor`, for number of examples already seen.
        mean: `float` `Tensor`, for starting mean of estimate.
        variance: `float` `Tensor`, for starting estimate of the variance.
  
      Returns:
        `RunningVariance` object, with given mean and variance estimate.
      """
      # TODO(b/173736911): Add this to RunningCovariance
      num_samples = tf.convert_to_tensor(
          num_samples, name="num_samples"
      )
      mean = tf.convert_to_tensor(mean, name="mean")
      variance = tf.convert_to_tensor(variance, name="variance")
      return cls(
          num_samples=num_samples,
          mean=mean,
          sum_squared_residuals=num_samples * variance,
          event_ndims=0,
      )
  
imports: import functools
  import math
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import nest_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.mcmc import diagnostic
  from tensorflow.python.util import nest
label_desc: Use image node_id 4 for calling the RunningVariance obj's underlying member method code with example usage: obj.from_stats(cls, num_samples, mean, variance) and returns: cls