cerebras.modelzoo.data.common.h5_map_dataset.samplers.BatchSampler#

class cerebras.modelzoo.data.common.h5_map_dataset.samplers.BatchSampler[source]#

Bases: torch.utils.data.Sampler, cerebras.modelzoo.data.common.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

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

Call self as a function.

static __new__(cls, *args: Any, **kwargs: Any) Any#