register_backend#
- scipy.fft.register_backend(backend)[source]#
Register a backend for permanent use.
Registered backends have the lowest priority and will be tried after the global backend.
Deprecated since version 2.0: The use of uarray to control the FFT backend is deprecated as of SciPy 2.0 and will be removed in SciPy 2.2. See Array API coverage for details on using alternative array types through the Python array API standard.
- Parameters:
- backend{object, ‘scipy’}
The backend to use. Can either be a
strcontaining the name of a known backend {‘scipy’} or an object that implements the uarray protocol.
- Raises:
- ValueError: If the backend does not implement
numpy.scipy.fft.
- ValueError: If the backend does not implement
Notes
Array API Standard Support
register_backendis not in-scope for support of Python Array API Standard compatible backends other than NumPy.See Support for the array API standard for more information.
Examples
We can register a new fft backend:
>>> from scipy.fft import fft, register_backend, set_global_backend >>> class NoopBackend: # Define an invalid Backend ... __ua_domain__ = "numpy.scipy.fft" ... def __ua_function__(self, func, args, kwargs): ... return NotImplemented >>> set_global_backend(NoopBackend()) # Set the invalid backend as global >>> register_backend("scipy") # Register a new backend # The registered backend is called because # the global backend returns `NotImplemented` >>> fft([1]) array([1.+0.j]) >>> set_global_backend("scipy") # Restore global backend to default