dpnp.ptp

dpnp.ptp(a, /, axis=None, out=None, keepdims=False)[source]

Range of values (maximum - minimum) along an axis.

For full documentation refer to numpy.ptp.

Returns:

ptp -- The range of a given array.

Return type:

dpnp.ndarray

Limitations

Input array is supported as dpnp.dpnp.ndarray or dpctl.tensor.usm_ndarray.

Examples

>>> import dpnp as np
>>> x = np.array([[4, 9, 2, 10],[6, 9, 7, 12]])
>>> np.ptp(x, axis=1)
array([8, 6])
>>> np.ptp(x, axis=0)
array([2, 0, 5, 2])
>>> np.ptp(x)
array(10)