BackendManager#
- class BackendManager[source]#
Bases:
object
Manager for template matching backends.
This class serves as an interface to various computational backends (e.g., CPU, GPU). It allows users to seamlessly swap between different backend implementations while preserving the consistency and functionality of the API. Direct attribute and method calls to the manager are delegated to the current active backend.
Notes
The backend has to be reinitialzed when using fork-based parallelism.
Examples
>>> from tme.backends import backend >>> backend.multiply(arr1, arr2) # This will use the default NumpyFFTWBackend's multiply method
>>> backend.change_backend("pytorch") >>> backend.multiply(arr1, arr2) # This will use the pytorchs multiply method
>>> backend.available_backends() # Backends available on your system
Methods
BackendManager.add_backend
(backend_name, ...)Adds a custom backend to the registry.
Returns available computation backends.
BackendManager.change_backend
(backend_name, ...)Change the current computation backend.