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
, ifaxis
is 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
axis
where it is of size 1. Otherwise, everyaxis
is squeezed, leading to an output tensor with fewer dimensions. If noaxis
is 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))