array_api
Utilities for working with the Python array API standard.
DASCore patch data can be backed by any array library which implements the array API standard. This module holds the small set of helpers needed to write backend-agnostic code and to cross the boundary back to numpy when a numpy-only implementation is used. Which array-likes are accepted as patch data is a separate question, and lives in compat.
Functions
| Name | Description |
|---|---|
| array_namespace | Return the array API namespace shared by arrays. |
| asarray_like | Return array converted to the backend and device of like. |
| backend_name | Return the name of the array backend which owns array. |
| decide_fallback |
Apply the numpy_fallback setting: refuse, warn, or say nothing.
|
| fallbacks_decided | Run what is inside with the conversions of the operations named decided. |
| is_foreign | Return True if the array belongs to a non-numpy array API backend. |
| is_numpy | Return True if the array is a numpy array or scalar. |
| lazy_read_backend | Return the array library lazy reads compute on, or None when eager. |
| lazy_refusal | Return the error for an operation which would have to read lazy data. |
| namespace_name | Return the backend name of an array API namespace. |
| nan_reduce | Reduce an array along an axis, ignoring nans. |
| parse_backend | Return whether a backend name is lazy, and the array library it names. |
| reading_lazily |
Have reads inside the block return lazy patches, computed on backend.
|
| refuse_lazy |
Raise lazy_refusal(name) if any of arrays is lazy; read none of them.
|
| to_backend | Return an array on the array library a name says. |
| to_numpy | Convert an array from any backend to a numpy array. |
| warn_numpy_fallback | Warn that name has no implementation for the given array backend. |