from_shape_prefix¶
- jaxrens.sampling.batch_descriptor.from_shape_prefix(shape_prefix)[source]¶
Return the batcher whose
shape_prefixmatches 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, andcli/monitor.pyto recover the batcher from a stored array’s leading shape (log_evidenceis the canonical witness — its shape is always exactly the prefix).Note:
ShardedSingleRuncheckpoints are stored in the SingleRun(1, ...)/scalar on-disk convention (via its ownflatten), so they never round-trip through the rank-1 branch here — restoring them is handled separately byrun.shard_n_gpu, not by shape-sniffing.- Raises:
ValueError – If shape_prefix has more than two leading dims.
- Parameters:
- Return type: