Utilities#
Array API#
- sequince.array_api.asarray(array, *, xp=None, dtype=None, like=None)[source]#
Convert an array while preserving the requested namespace and device.
- sequince.array_api.copy(array, *, xp=None)[source]#
Copy an array without changing its namespace or device.
For JAX and PyTorch arrays, this will create a new array on the same device and preserves gradient tracking.
- sequince.array_api.determine_backend_name(x=None, xp=None)[source]#
Determine the backend name from an array or array API module.
- Parameters:
x (Array or None) – The array to infer the backend from. If None, xp must be provided.
xp (Any or None) – The array API module to infer the backend from. If None, x must be provided.
- Returns:
The name of the backend. If the backend cannot be determined, returns “unknown”.
- Return type:
- sequince.array_api.enable_scipy_array_api()[source]#
Enable SciPy Array API support; normally done during package import.
- Return type:
None
- sequince.array_api.namespace(*arrays)[source]#
Return the array API namespace associated with the provided arrays.
- Parameters:
arrays (Any)
General utilities#
Utility functions for Sequince.