skbio.util.array_api_compatible#

skbio.util.array_api_compatible(backends, devices=None)[source]#

Mark a function as compatible with the Python array API standard.

Parameters:
backendslist of str

Supported backends: ‘numpy’, ‘cupy’, ‘torch’, ‘jax’, ‘dask’.

deviceslist of str, optional

Supported devices: ‘cpu’, ‘gpu’. Defaults to per-backend defaults.

Notes

This decorator has two effects:

  1. An array API compatibility table is inserted into the Notes section of the function’s docstring.

  2. At runtime, if the caller passes an array API object from an unsupported backend, a TypeError is raised.

The decorated function gains two attributes: _array_api_backends and _array_api_devices.