function moments_(x, axis = null, keepDims = false) {
    x = (0, _tensorUtilEnv.convertToTensor)(x, "x", "moments");
    const axes = (0, _util.parseAxisParam)(axis, x.shape);
    const xMean = (0, _mean.mean)(x, axes, keepDims);
    let keepDimsShape = xMean.shape;
    if (!keepDims) keepDimsShape = (0, _axisUtil.expandShapeToKeepDim)(xMean.shape, axes);
    const devSquared = (0, _square.square)((0, _sub.sub)((0, _cast.cast)(x, "float32"), (0, _reshape.reshape)(xMean, keepDimsShape)));
    const variance = (0, _mean.mean)(devSquared, axes, keepDims);
    return {
        mean: xMean,
        variance
    };
}
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.

@param x The input tensor.
@param axis The dimension(s) along with to compute mean and
    variance. By default it reduces all dimensions.
@param keepDims If true, the moments have the same dimensionality as the
    input.
@return An object with two keys: `mean` and `variance`.

@doc {heading: 'Operations', subheading: 'Normalization'}