colour.utilities.xp_unique#

colour.utilities.xp_unique(a: ArrayLike, *, xp: ProtocolArrayNamespace | ModuleType | None = None, **kwargs: Any) NDArray | tuple[NDArray, ...][source]#

Array API compatible implementation of numpy.unique() with extra keyword arguments such as return_index and axis.

The Array API standard only provides xp.unique_values and related functions without return_index or axis support. This helper tries the backend’s native unique first, falling back to NumPy if the keywords are unsupported.

Parameters:
Returns:

Unique values (and optional indices).

Return type:

object