# tf.nn.sufficient_statistics

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/nn/sufficient_statistics) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/nn_impl.py#L1053-L1107) |

Calculate the sufficient statistics for the mean and variance of `x`.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.nn.sufficient_statistics`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/nn/sufficient_statistics)

<br />

    tf.nn.sufficient_statistics(
        x, axes, shift=None, keep_dims=None, name=None, keepdims=None
    )

These sufficient statistics are computed using the one pass algorithm on
an input that's optionally shifted. See:
<https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Computing_shifted_data>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A `Tensor`. |
| `axes` | Array of ints. Axes along which to compute mean and variance. |
| `shift` | A `Tensor` containing the value by which to shift the data for numerical stability, or `None` if no shift is to be performed. A shift close to the true mean provides the most numerically stable results. |
| `keep_dims` | produce statistics with the same dimensionality as the input. |
| `name` | Name used to scope the operations that compute the sufficient stats. |
| `keepdims` | Alias for keep_dims. |

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Four `Tensor` objects of the same type as `x`: <br /> - the count (number of elements to average over). - the (possibly shifted) sum of the elements in the array. - the (possibly shifted) sum of squares of the elements in the array. - the shift by which the mean must be corrected or None if `shift` is None. ||

<br />