Computes the mean of elements across dimensions of a tf.Tensor.
Reduces x along the dimensions given in axis. Unless keepDims is
true, the rank of the tf.Tensor is reduced by 1 for each entry in axis.
If keepDims is true, the reduced dimensions are retained with length 1.
If axis has no entries, all dimensions are reduced, and a tf.Tensor with
a single element is returned.
constx = tf.tensor1d([1, 2, 3]);
x.mean().print(); // or tf.mean(a)
constx = tf.tensor2d([1, 2, 3, 4], [2, 2]);
constaxis = 1; x.mean(axis).print(); // or tf.mean(x, axis)
Computes the mean of elements across dimensions of a
tf.Tensor.Reduces
xalong the dimensions given inaxis. UnlesskeepDimsis true, the rank of thetf.Tensoris reduced by 1 for each entry inaxis. IfkeepDimsis true, the reduced dimensions are retained with length 1. Ifaxishas no entries, all dimensions are reduced, and atf.Tensorwith a single element is returned.