cupy.setdiff1d#

cupy.setdiff1d(ar1, ar2, assume_unique=False)[source]#

Find the set difference of two arrays. It returns unique values in ar1 that are not in ar2.

Parameters:
  • ar1 (cupy.ndarray) – Input array

  • ar2 (cupy.ndarray) – Input array for comparison

  • assume_unique (bool) – By default, False, i.e. input arrays are not unique. If True, input arrays are assumed to be unique. This can speed up the calculation.

Returns:

setdiff1d – Returns a 1D array of values in ar1 that are not in ar2. It always returns a sorted output for unsorted input only if assume_unique=False.

Return type:

cupy.ndarray

See also

numpy.setdiff1d