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))
. Ifcondition
is boolean,np.extract
is equivalent toarr[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:
Warning
This function may synchronize the device.
See also