class_docstr: Computes a running mean.
  
  In computation, samples can be provided individually or in chunks. A
  "chunk" of size M implies incorporating M samples into a single expectation
  computation at once, which is more efficient than one by one.
  
  `RunningMean` is meant to serve general streaming expectations.
  For a specialized version that fits streaming over MCMC samples, see
  `ExpectationsReducer` in `tfp.experimental.mcmc`.
docstr: Initialize an empty `RunningMean`.
  
  Args:
    shape: Python `Tuple` or `TensorShape` representing the shape of
      incoming samples.
    dtype: Dtype of incoming samples and the resulting statistics.
      By default, the dtype is `tf.float32`. Any integer dtypes will be
      cast to corresponding floats (i.e. `tf.int32` will be cast to
      `tf.float32`), as intermediate calculations should be performing
      floating-point division.
  
  Returns:
    state: `RunningMean` representing a stream of no inputs.
docstr_tok: ["Initialize","an","empty","`","RunningMean","`",".","Args",":","shape",":","Python","`","Tuple","`","or","`","TensorShape","`","representing","the","shape","of","incoming","samples",".","dtype",":","Dtype","of","incoming","samples","and","the","resulting","statistics",".","By","default",",","the","dtype","is","`","tf.float32","`",".","Any","integer","dtypes","will","be","cast","to","corresponding","floats","(","i.e",".","`","tf.int32","`","will","be","cast","to","`","tf.float32","`",")",",","as","intermediate","calculations","should","be","performing","floating-point","division",".","Returns",":","state",":","`","RunningMean","`","representing","a","stream","of","no","inputs","."]
code: def from_shape(cls, shape, dtype=tf.float32):
      """Initialize an empty `RunningMean`.
  
      Args:
        shape: Python `Tuple` or `TensorShape` representing the shape of
          incoming samples.
        dtype: Dtype of incoming samples and the resulting statistics.
          By default, the dtype is `tf.float32`. Any integer dtypes will be
          cast to corresponding floats (i.e. `tf.int32` will be cast to
          `tf.float32`), as intermediate calculations should be performing
          floating-point division.
  
      Returns:
        state: `RunningMean` representing a stream of no inputs.
      """
      dtype = _float_dtype_like(dtype)
      return cls(
          num_samples=tf.zeros((), dtype=dtype),
          mean=tf.zeros(shape, dtype),
      )
  
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 RunningMean obj's underlying member method code with example usage: obj.from_shape(cls, shape, dtype) and returns: cls