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 1 version](/versions/r1.15/api_docs/python/tf/nn/moments) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/python/ops/nn_impl.py#L1333-L1367) |\n\nCalculates the mean and variance of `x`. \n\n tf.nn.moments(\n x, axes, shift=None, keepdims=False, name=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| `keepdims` | produce moments with the same dimensionality as the input. |\n| `name` | Name used to scope the operations that compute the moments. |\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"]]