tf.nn.moments

View source on GitHub

Calculates the mean and variance of x.

tf.nn.moments(
    x, axes, shift=None, keepdims=False, name=None
)

The mean and variance are calculated by aggregating the contents of x across axes. If x is 1-D and axes = [0] this is just the mean and variance of a vector.

Note: shift is currently not used; the true mean is computed and used.

When using these moments for batch normalization (see tf.nn.batch_normalization):

Args:

Returns:

Two Tensor objects: mean and variance.