VmapRuns¶
- class jaxrens.sampling.batch_descriptor.VmapRuns(n_runs, shape_prefix=())[source]¶
Bases:
_UniformBatcherDescriptor for n_runs independent NS runs batched via
jax.vmap.Used by
run_ns_parallel.- Variables:
n_runs (
int) – Number of independent NS runs.shape_prefix (
tuple[int,]) –(n_runs,)— leading dimension of all batched arrays.
- Parameters:
- wrap_step(ns_step_fn, step_fn, n_mcmc_steps, n_extra)[source]¶
Return a JIT-compiled vmapped NS step.
The closure captures
step_fn,n_mcmc_steps, andn_extraas Python-level static values so vmap sees no dynamic static args. A singlemove_key(from replica 0’s key, outside the vmap) is passed to every run so the MWG move index stays unbatched — see_wrap_batched_step().The returned function has signature:
jit_step(ns_states) -> (ns_states, infos)
which matches the current
run_ns_parallelinner step pattern.