colour.utilities.xp_isin#
- colour.utilities.xp_isin(element: ArrayLike, test_elements: ArrayLike, *, xp: ProtocolArrayNamespace | ModuleType | None = None, like: Any = None) NDArrayBoolean[source]#
Array API compatible implementation of
numpy.isin().Use the backend’s native
isinwhen available (JAX, CuPy), otherwise fall back to NumPy.- Parameters:
element (ArrayLike) – Input array.
test_elements (ArrayLike) – Values against which to test each element of element.
xp (ProtocolArrayNamespace | ModuleType | None) – Array namespace module. If None, derived from
elementandtest_elements.like (Any) – Reference array whose device
test_elementsshould be placed on when promoted toxp. Defaults toelementwhen None.
- Returns:
Boolean array of the same shape as element.
- Return type:
Notes
NaNis treated as not equal to itself, matchingnumpy.isin()semantics;xp_isin([NaN], [NaN])returns[False].