dpctl.tensor.mean

dpctl.tensor.mean(x, axis=None, keepdims=False)[source]

Calculates the arithmetic mean of elements in the input array x.

Parameters:
  • x (usm_ndarray) – input array.

  • axis (Optional[int, Tuple[int, ...]]) – axis or axes along which the arithmetic means must be computed. If a tuple of unique integers, the means are computed over multiple axes. If None, the mean is computed over the entire array. Default: None.

  • keepdims (Optional[bool]) – if True, the reduced axes (dimensions) are included in the result as singleton dimensions, so that the returned array remains compatible with the input array according to Array Broadcasting rules. Otherwise, if False, the reduced axes are not included in the returned array. Default: False.

Returns:

an array containing the arithmetic means. If the mean was computed over the entire array, a zero-dimensional array is returned.

If x has a floating-point data type, the returned array will have the same data type as x. If x has a boolean or integral data type, the returned array will have the default floating point data type for the device where input array x is allocated.

Return type:

usm_ndarray