reduce_mean

ivy.reduce_mean(x, axis=None, keepdims=False, f=None)[source]

Computes the arithmetic mean along a given axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis.

Parameters
  • x (array) – Array containing numbers whose mean is desired.

  • axis (int or sequence of ints) – Axis or axes along which the means are computed. The default is to compute the mean of the flattened array. If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

  • keepdims (bool, optional) – If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The array with means computed.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty