flashquad.utils.backend¶
Backend resolution and dtype validation.
Module Contents¶
Functions¶
Resolve a backend string to its array namespace. |
|
Return the namespace-native default floating dtype. |
|
Raise TypeError when dtype is incompatible with backend_name. |
|
Resolve compute device for the given backend. |
|
Move tensor to device when the backend supports it. |
Data¶
API¶
- flashquad.utils.backend._BACKEND_MODULES¶
None
- flashquad.utils.backend._TORCH_BACKENDS¶
‘frozenset(…)’
- flashquad.utils.backend._NUMPY_COMPAT_BACKENDS¶
‘frozenset(…)’
- flashquad.utils.backend._resolve_backend_namespace(backend)¶
Resolve a backend string to its array namespace.
- flashquad.utils.backend._default_dtype(xp)¶
Return the namespace-native default floating dtype.
- flashquad.utils.backend._validate_dtype(backend_name, dtype)¶
Raise TypeError when dtype is incompatible with backend_name.
- flashquad.utils.backend._resolve_device(backend_name, device)¶
Resolve compute device for the given backend.
For
'torch'and'jax', auto-selects GPU when available if device isNone. Other backends returnNone(cupy is inherently GPU; numpy is CPU-only).
- flashquad.utils.backend._to_device(tensor, device)¶
Move tensor to device when the backend supports it.