tf.nn.moments(
x,
axes,
shift=None,
name=None,
keep_dims=False
)
Defined in tensorflow/python/ops/nn_impl.py.
See the guide: Neural Network > Normalization
Calculate the mean and variance of x.
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):
[batch, height, width, depth], pass axes=[0, 1, 2].axes=[0] (batch only).x: A Tensor.axes: Array of ints. Axes along which to compute mean and variance.shift: Not used in the current implementationname: Name used to scope the operations that compute the moments.keep_dims: produce moments with the same dimensionality as the input.Two Tensor objects: mean and variance.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/nn/moments