modelzoo.transformers.data_processing.h5_map_dataset.samplers.BatchSampler#

class modelzoo.transformers.data_processing.h5_map_dataset.samplers.BatchSampler[source]#

Bases: torch.utils.data.Sampler

A slight modification of the PyTorch batch sampler such that any samples not yielded at the end of an epoch when drop_last=True will be yielded at the start of the next epoch. This is necessary for shard-invariance.

Adapted from the PyTorch batch sampler

Methods

__call__(*args: Any, **kwargs: Any) Any#

Call self as a function.

__init__(sampler, batch_size, drop_last)[source]#
static __new__(cls, *args: Any, **kwargs: Any) Any#