MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / moments_v2

Function moments_v2

tensorflow/python/ops/nn_impl.py:1336–1368  ·  view source on GitHub ↗

Calculates 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 usi

(
    x,
    axes,
    shift=None,
    keepdims=False,
    name=None)

Source from the content-addressed store, hash-verified

1334
1335@tf_export("nn.moments", v1=[])
1336def moments_v2(
1337 x,
1338 axes,
1339 shift=None,
1340 keepdims=False,
1341 name=None):
1342 """Calculates the mean and variance of `x`.
1343
1344 The mean and variance are calculated by aggregating the contents of `x`
1345 across `axes`. If `x` is 1-D and `axes = [0]` this is just the mean
1346 and variance of a vector.
1347
1348 Note: shift is currently not used; the true mean is computed and used.
1349
1350 When using these moments for batch normalization (see
1351 `tf.nn.batch_normalization`):
1352
1353 * for so-called "global normalization", used with convolutional filters with
1354 shape `[batch, height, width, depth]`, pass `axes=[0, 1, 2]`.
1355 * for simple batch normalization pass `axes=[0]` (batch only).
1356
1357 Args:
1358 x: A `Tensor`.
1359 axes: Array of ints. Axes along which to compute mean and
1360 variance.
1361 shift: Not used in the current implementation.
1362 keepdims: produce moments with the same dimensionality as the input.
1363 name: Name used to scope the operations that compute the moments.
1364
1365 Returns:
1366 Two `Tensor` objects: `mean` and `variance`.
1367 """
1368 return moments(x=x, axes=axes, shift=shift, name=name, keep_dims=keepdims)
1369
1370
1371@tf_export(v1=["nn.weighted_moments"])

Callers

nothing calls this directly

Calls 1

momentsFunction · 0.85

Tested by

no test coverage detected