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(b"jax", precision="32b") >>> pyhf.tensorlib.name 'jax' >>> pyhf.tensorlib.precision '32b' >>> pyhf.set_backend(pyhf.tensor.numpy_backend()) >>> pyhf.tensorlib.name 'numpy' >>> pyhf.tensorlib.precision '64b'
- Parameters:
backend (
strorbytesor pyhf.tensor backend) – One of the supported pyhf backends: NumPy and JAXcustom_optimizer (
strorbytesor pyhf.optimize optimizer orNone) – Optional custom optimizer defined by the userprecision (
strorbytesorNone) – Floating point precision to use in the backend:64bor32b. Default is backend dependent.default (
bool) – Set the backend as the default backend additionally
- Returns:
None