View source on GitHub |
Calculate the mean and variance of x
.
tf.compat.v1.nn.moments(
x, axes, shift=None, name=None, keep_dims=None, keepdims=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.
When using these moments for batch normalization (see
tf.nn.batch_normalization
):
- for so-called "global normalization", used with convolutional filters with
shape
[batch, height, width, depth]
, passaxes=[0, 1, 2]
. - for simple batch normalization pass
axes=[0]
(batch only).
Returns | |
---|---|
Two Tensor objects: mean and variance .
|