tf.compat.v1.nn.moments
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.
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
):
for so-called "global normalization", used with convolutional filters with
shape [batch, height, width, depth]
, pass axes=[0, 1, 2]
.
for simple batch normalization pass axes=[0]
(batch only).
Args
x
A Tensor
.
axes
Array of ints. Axes along which to compute mean and
variance.
shift
Not used in the current implementation
name
Name used to scope the operations that compute the moments.
keep_dims
produce moments with the same dimensionality as the input.
keepdims
Alias to keep_dims.
Returns
Two Tensor
objects: mean
and variance
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license .
Last updated 2022-11-04 UTC.
[null,null,["Last updated 2022-11-04 UTC."],[],[]]