from_shape_prefix

jaxrens.sampling.batch_descriptor.from_shape_prefix(shape_prefix)[source]

Return the batcher whose shape_prefix matches shape_prefix.

  • () → SingleRun.

  • (R,) → VmapRuns(n_runs=R).

  • (G, P) → PmapVmapRuns(n_gpu=G, n_per_gpu=P).

Used by init/restart.py, io/checkpoint.py, and cli/monitor.py to recover the batcher from a stored array’s leading shape (log_evidence is the canonical witness — its shape is always exactly the prefix).

Note: ShardedSingleRun checkpoints are stored in the SingleRun (1, ...)/scalar on-disk convention (via its own flatten), so they never round-trip through the rank-1 branch here — restoring them is handled separately by run.shard_n_gpu, not by shape-sniffing.

Raises:

ValueError – If shape_prefix has more than two leading dims.

Parameters:

shape_prefix (tuple[int, ...])

Return type:

SingleRun | VmapRuns | PmapVmapRuns | ShardedSingleRun