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.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.nn.moments\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/nn/moments) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/nn_impl.py#L1171-L1233) |\n\nCalculate the mean and variance of `x`.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.nn.moments`](/api_docs/python/tf/compat/v1/nn/moments)\n\n\u003cbr /\u003e\n\n tf.nn.moments(\n x, axes, shift=None, name=None, keep_dims=None, keepdims=None\n )\n\nThe mean and variance are calculated by aggregating the contents of `x`\nacross `axes`. If `x` is 1-D and `axes = [0]` this is just the mean\nand variance of a vector.\n| **Note:** shift is currently not used; the true mean is computed and used.\n\nWhen using these moments for batch normalization (see\n[`tf.nn.batch_normalization`](../../tf/nn/batch_normalization)):\n\n- for so-called \"global normalization\", used with convolutional filters with shape `[batch, height, width, depth]`, pass `axes=[0, 1, 2]`.\n- for simple batch normalization pass `axes=[0]` (batch only).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|---------------------------------------------------------------|\n| `x` | A `Tensor`. |\n| `axes` | Array of ints. Axes along which to compute mean and variance. |\n| `shift` | Not used in the current implementation |\n| `name` | Name used to scope the operations that compute the moments. |\n| `keep_dims` | produce moments with the same dimensionality as the input. |\n| `keepdims` | Alias to keep_dims. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Two `Tensor` objects: `mean` and `variance`. ||\n\n\u003cbr /\u003e"]]