bundles / scipy 1.17.1 / scipy / fft / _backend / set_global_backend
function
scipy.fft._backend:set_global_backend
source: /scipy/fft/_backend.py :52
Signature
def set_global_backend ( backend , coerce = False , only = False , try_last = False ) Summary
Sets the global fft backend
Extended Summary
This utility method replaces the default backend for permanent use. It will be tried in the list of backends automatically, unless the only flag is set on a backend. This will be the first tried backend outside the set_backend context manager.
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.coerce: boolWhether to coerce input types when trying this backend.
only: boolIf
True, no more backends will be tried if this fails. Implied bycoerce=True.try_last: boolIf
True, the global backend is tried after registered backends.
Raises
: ValueError: If the backend does not implement ``numpy.scipy.fft``.
Notes
This will overwrite the previously set global backend, which, by default, is the SciPy implementation.
Array API Standard Support
set_global_backend is not in-scope for support of Python Array API Standard compatible backends other than NumPy.
See dev-arrayapi for more information.
Examples
We can set the global fft backend:from scipy.fft import fft, set_global_backend set_global_backend("scipy") # Sets global backend (default is "scipy").✓
fft([1]) # Calls the global backend
✗Aliases
-
scipy.fft.set_global_backend