colour.utilities.xp_pad#
- colour.utilities.xp_pad(a: ArrayLike, pad_width: Any, *args: Any, xp: ProtocolArrayNamespace | ModuleType | None = None, **kwargs: Any) NDArray[source]#
Array API compatible implementation of
numpy.pad().Use the backend’s native
padwhen available (JAX, CuPy), otherwise fall back to NumPy.- Parameters:
a (ArrayLike) – Array to pad.
pad_width (Any) – Number of values padded to the edges of each axis.
*args (Any) – Positional arguments passed to the padding function.
xp (ProtocolArrayNamespace | ModuleType | None) – Array namespace module. If None, derived from
a.**kwargs (Any) – Keyword arguments passed to the padding function.
- Returns:
Padded array.
- Return type: