mlx.core.mean#

mlx.core.mean(a: array, /, axis: Union[None, int, List[int]] = None, keepdims: bool = False, *, stream: Union[None, Stream, Device] = None) array#

Compute the mean(s) over the given axes.

Parameters:
  • a (array) – Input array.

  • axis (int or list(int), optional) – Optional axis or axes to reduce over. If unspecified this defaults to reducing over the entire array.

  • keepdims (bool, optional) – Keep reduced axes as singleton dimensions, defaults to False.

Returns:

The output array of means.

Return type:

array