colour.utilities.xp_gradient#

colour.utilities.xp_gradient(f: ArrayLike, *varargs: Any, xp: ProtocolArrayNamespace | ModuleType | None = None, axis: int) NDArrayFloat[source]#
colour.utilities.xp_gradient(f: ArrayLike, *varargs: Any, xp: ProtocolArrayNamespace | ModuleType | None = None, axis: None = None) NDArrayFloat | list[NDArrayFloat]

Array API compatible implementation of numpy.gradient().

Parameters:
  • f (ArrayLike) – Array of function values.

  • *varargs (Any) – Spacing between values.

  • xp (ProtocolArrayNamespace | ModuleType | None) – Array namespace module. If None, derived from f.

  • axis (Any) – Axis along which to compute the gradient.

Returns:

Gradient of f.

Return type:

object