pyhs3.JaxifiedGraph¶
- class pyhs3.JaxifiedGraph(inputs, input_names, fn)[source]¶
A JAX-callable wrapper around a compiled PyTensor expression.
Produced by
jaxify(). Supports keyword-argument calls (the primary interface for dict-pytree-based optimizers like optimistix or everwillow) and positional calls viacall_positional().Calling a
JaxifiedGraphdoes not jit it: JAX runs the graph eagerly, one operation at a time, which on a large likelihood is orders of magnitude slower than the same call wrapped injax.jit. Wrap it for any repeated evaluation:jg = jaxify(model.log_prob) nll = jax.jit(lambda params: -jg(**params)[0])
For a likelihood evaluated repeatedly without JAX,
pyhs3.Model.compile_nll()compiles it for you.- Variables:
inputs – Tuple of PyTensor input variables, in evaluation order.
input_names – Names of those variables (same order as
inputs).fn – The raw JAX callable returned by
jax_funcify.
- Parameters:
- __init__(inputs, input_names, fn)¶
Methods
__init__(inputs, input_names, fn)call_positional(*args)Call with positional arguments — pure passthrough to
fn.Attributes
- JaxifiedGraph.call_positional(*args)[source]¶
Call with positional arguments — pure passthrough to
fn.Like calling the graph, this is not jitted; wrap it in
jax.jitfor repeated use.
- JaxifiedGraph.inputs¶
- JaxifiedGraph.input_names¶
- JaxifiedGraph.fn¶