# cupy.extract¶

cupy.extract(condition, a)[source]

Return the elements of an array that satisfy some condition.

This is equivalent to np.compress(ravel(condition), ravel(arr)). If condition is boolean, np.extract is equivalent to arr[condition].

Parameters
• condition (int or array_like) – An array whose nonzero or True entries indicate the elements of array to extract.

• a (cupy.ndarray) – Input array of the same size as condition.

Returns

Rank 1 array of values from arr where condition is True.

Return type

cupy.ndarray

Warning

This function may synchronize the device.