pyhf.set_backend#
- pyhf.set_backend(backend: str | bytes | pyhf.typing.TensorBackend, custom_optimizer: str | bytes | pyhf.typing.Optimizer | None = None, precision: str | bytes | None = None, default: bool = False) None [source]#
Set the backend and the associated optimizer
Example
>>> import pyhf >>> pyhf.set_backend(pyhf.tensor.numpy_backend()) >>> pyhf.tensorlib.name 'numpy' >>> pyhf.tensorlib.precision '64b'
- Parameters:
backend (
str
orbytes
or pyhf.tensor backend) – One of the supported pyhf backends: NumPy and JAXcustom_optimizer (
str
orbytes
or pyhf.optimize optimizer orNone
) – Optional custom optimizer defined by the userprecision (
str
orbytes
orNone
) – Floating point precision to use in the backend:64b
or32b
. Default is backend dependent.default (
bool
) – Set the backend as the default backend additionally
- Returns:
None