Backend
This section documents backend-related utilities exposed by KeyDNN’s public API.
Backend APIs allow users to query system capabilities without directly depending on internal infrastructure or native bindings.
cuda_available
Return whether KeyDNN's CUDA native backend appears to be available.
This function attempts to load the KeyDNN CUDA native library via
load_keydnn_cuda_native(). If the library loads successfully, CUDA is
considered available; otherwise, the function returns False.
The check is best used as a fast feature gate for optional CUDA execution.
Returns:
| Type | Description |
|---|---|
bool
|
|
Notes
- All exceptions raised by the underlying loader are swallowed and mapped
to
False. If you need diagnostics, callload_keydnn_cuda_native()directly to surface the underlying error.
Notes
cuda_available()can be used to conditionally enable CUDA-specific logic.- This function reflects whether CUDA support is available at runtime, not whether a particular tensor or model is currently on a CUDA device.
- Backend initialization is handled internally; users should not manually load or manage native libraries.