# cupy.clip¶

cupy.clip(a, a_min=None, a_max=None, out=None)[source]

Clips the values of an array to a given interval.

This is equivalent to maximum(minimum(a, a_max), a_min), while this function is more efficient.

Parameters
• a (cupy.ndarray) – The source array.

• a_min (scalar, cupy.ndarray or None) – The left side of the interval. When it is None, it is ignored.

• a_max (scalar, cupy.ndarray or None) – The right side of the interval. When it is None, it is ignored.

• out (cupy.ndarray) – Output array.

Returns

Clipped array.

Return type

cupy.ndarray