bundles / scipy 1.17.1 / scipy / fft / _backend / set_backend
function
scipy.fft._backend:set_backend
source: /scipy/fft/_backend.py :138
Signature
def set_backend ( backend , coerce = False , only = False ) Summary
Context manager to set the backend within a fixed scope.
Extended Summary
Upon entering the with statement, the given backend will be added to the list of available backends with the highest priority. Upon exit, the backend is reset to the state before entering the scope.
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: bool, optionalWhether to allow expensive conversions for the
xparameter. e.g., copying a NumPy array to the GPU for a CuPy backend. Impliesonly.only: bool, optionalIf only is
Trueand this backend returnsNotImplemented, then a BackendNotImplemented error will be raised immediately. Ignoring any lower priority backends.
Notes
Array API Standard Support
set_backend is not in-scope for support of Python Array API Standard compatible backends other than NumPy.
See dev-arrayapi for more information.
Examples
import scipy.fft as fft
✓with fft.set_backend('scipy', only=True): fft.fft([1]) # Always calls the scipy implementation✗
Aliases
-
scipy.fft.set_backend