dpnp.max
- dpnp.max(a, axis=None, out=None, keepdims=False, initial=None, where=True)[source]
Return the maximum of an array or maximum along an axis.
For full documentation refer to
numpy.max.- Parameters:
a ({dpnp.ndarray, usm_ndarray}) – Input array.
axis (int or tuple of ints, optional) – Axis or axes along which maximum values must be computed. By default, the maximum value must be computed over the entire array. If a tuple of integers, maximum values must be computed over multiple axes. Default:
None.out ({None, dpnp.ndarray, usm_ndarray}, optional) – If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
keepdims (bool) – If
True, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array. Otherwise, ifFalse, the reduced axes (dimensions) must not be included in the result. Default:False.
- Returns:
out (dpnp.ndarray) – If the maximum value was computed over the entire array, a zero-dimensional array containing the maximum value; otherwise, a non-zero-dimensional array containing the maximum values. The returned array must have the same data type as a.
Limitations
———–.
Parameters where, and initial are only supported with their default
values. Otherwise
NotImplementedErrorexception will be raised.
See also
dpnp.minReturn the minimum of an array.
dpnp.maximumElement-wise maximum of two arrays, propagates NaNs.
dpnp.fmaxElement-wise maximum of two arrays, ignores NaNs.
dpnp.amaxThe maximum value of an array along a given axis, propagates NaNs.
dpnp.nanmaxThe maximum value of an array along a given axis, ignores NaNs.
Examples
>>> import dpnp as np >>> a = np.arange(4).reshape((2,2)) >>> a array([[0, 1], [2, 3]]) >>> np.max(a) array(3)
>>> np.max(a, axis=0) # Maxima along the first axis array([2, 3]) >>> np.max(a, axis=1) # Maxima along the second axis array([1, 3])
>>> b = np.arange(5, dtype=float) >>> b[2] = np.NaN >>> np.max(b) array(nan)