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, modelzoo.transformers.data_processing.h5_map_dataset.samplers.PaddedSampler

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

Attributes

pad_index

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

Call self as a function.

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