SessionBatchSampler#
- class core.samplers.SessionBatchSampler(sampler, batch_size, *, shuffle_batches=False, generator=None, drop_last=True)[source]#
Bases:
torch.utils.data.sampler.SamplerGroup any
DatasetIndexsampler’s output into per-session batches.All indices in a batch share the same session id. The inner sampler controls the order of indices within each session;
shuffle_batchescontrols the order of batches across sessions.- Parameters:
sampler (
Sampler) – Inner sampler whose__iter__yieldsDatasetIndexobjects.batch_size (
int) – Number of samples per batch.shuffle_batches (
bool) – Whether to shuffle the final batch order. Defaults to False.generator (
Optional[Generator]) – Generator used when shuffling batches. Defaults to None.drop_last (
bool) – Whether to drop the last incomplete batch per session. Defaults to True.