colour.utilities.xp_round#

colour.utilities.xp_round(a: ArrayLike, *, decimals: int = 0, xp: ProtocolArrayNamespace | ModuleType | None = None) NDArrayFloat[source]#

Array API compatible implementation of numpy.round() with decimals.

The Array API standard xp.round does not accept a decimals parameter. This helper uses the backend’s native round when it supports decimals (JAX, CuPy), otherwise falls back to a multiply-round-divide pattern using the standard xp.round.

Parameters:
Returns:

Rounded array.

Return type:

object