SingleRun

class jaxrens.sampling.batch_descriptor.SingleRun(n_runs=1, shape_prefix=())[source]

Bases: _UniformBatcher

Descriptor for a single NS run (no batching).

Used by run_ns. All three methods are identity / thin wrappers around plain JAX primitives.

Variables:
  • n_runs (int) – Always 1.

  • shape_prefix (tuple[int, ]) – Always ().

Parameters:
property is_batched: bool

Always False — single NS run, no batch dimension.

wrap_step(ns_step_fn, step_fn, n_mcmc_steps, n_extra)[source]

Return jax.jit(ns_step_fn, static_argnums=(1, 2, 3)).

The caller uses the returned function as:

jit_step(ns_state, step_fn, n_mcmc_steps, n_extra)

which is exactly the current run_ns pattern.

Parameters:
  • n_mcmc_steps (int)

  • n_extra (int)

split_keys(rng_key, n_sub_keys)[source]

Delegate directly to jax.random.split.

Returns shape (n_sub_keys,) with typed-key dtype.

Parameters:
  • rng_key (Array)

  • n_sub_keys (int)

Return type:

Array

reduce_for_termination(log_evidence, hmax)[source]

Identity reduction — single run has no worst-case to aggregate.

Return type:

(float(log_evidence), float(hmax))

Parameters: