giagrad.Tensor.mean#
- Tensor.mean(axis=None, keepdims=False) Tensor[source]#
Returns the mean value of each 1-D slice of the tensor in the given
axis, ifaxisis a list of dimensions, reduce over all of them.If keepdims is True, the output tensor is of the same size as input except in the
axiswhere it is of size 1. Otherwise, everyaxisis squeezed, leading to an output tensor with fewer dimensions. If noaxisis supplied all data is reduced to a scalar value.- Parameters:
Examples
>>> t = Tensor(np.arange(12).reshape((2,2,3))) >>> t tensor: [[[ 0. 1. 2.] [ 3. 4. 5.]] ... [[ 6. 7. 8.] [ 9. 10. 11.]]] >>> t.mean(axis=(0, 1), keepdims=True) tensor: [[[4.5 5.5 6.5]]] fn: Mean(axis=(0, 1))