@@ -6,6 +6,9 @@ This is a minor release from ``v0.6.3`` → ``v0.7.0``.
66Important Notes
77---------------
88
9+ * A `pyhf.default_backend ` has been added that is configurable through a
10+ ``default `` kwarg in :func: `pyhf.set_backend `.
11+ (PR :pr: `1646 `)
912* All backends are now fully compatible and tested with
1013 `Python 3.10 <https://peps.python.org/pep-0310/ >`_.
1114 (PR :pr: `1809 `)
@@ -60,6 +63,31 @@ Python API
6063 ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000
6164 ... )
6265
66+ * A ``pyhf.default_backend `` has been added that is configurable through a
67+ ``default `` kwarg in :func: `pyhf.set_backend `.
68+ (PR :pr: `1646 `)
69+ This allows setting setting the ``pyhf.default_backend `` to be different from the value of
70+ ``pyhf.tensorlib `` returned by :func: `pyhf.get_backend `, which can be useful in situations where
71+ a model construction is needed.
72+
73+ .. code :: pycon
74+
75+ >>> import jax
76+ >>> import pyhf
77+ >>> pyhf.set_backend("jax", default=True)
78+ >>> pyhf.set_backend("numpy")
79+ >>> pyhf.get_backend()
80+ (<pyhf.tensor.numpy_backend.numpy_backend object at 0x...>, <pyhf.optimize.scipy_optimizer object at 0x...>)
81+ >>> pyhf.default_backend
82+ <pyhf.tensor.jax_backend.jax_backend object at 0x...>
83+ >>> def example_op(x):
84+ ... return 2 * pyhf.default_backend.power(pyhf.default_backend.astensor(x), 3)
85+ ...
86+ >>> example_op([2.0])
87+ DeviceArray([16.], dtype=float64)
88+ >>> jax.jacrev(jax.jit(example_op))([2.0])
89+ [DeviceArray([24.], dtype=float64, weak_type=True)]
90+
6391 Deprecations
6492------------
6593
0 commit comments