cupy.ptp#

cupy.ptp(a, axis=None, out=None, keepdims=False)[source]#

Returns the range of values (maximum - minimum) along an axis.

Note

The name of the function comes from the acronym for ‘peak to peak’.

When at least one element is NaN, the corresponding ptp value will be NaN.

Parameters:
  • a (cupy.ndarray) – Array over which to take the range.

  • axis (int) – Axis along which to take the minimum. The flattened array is used by default.

  • out (cupy.ndarray) – Output array.

  • keepdims (bool) – If True, the axis is retained as an axis of size one.

Returns:

The minimum of a, along the axis if specified.

Return type:

cupy.ndarray

Note

When cuTENSOR accelerator is used, the output value might be collapsed for reduction axes that have one or more NaN elements.

See also

numpy.amin()