ReproducibleBatchSampler#
- class ignite.engine.deterministic.ReproducibleBatchSampler(batch_sampler, start_iteration=None)[source]#
Reproducible batch sampler. This class internally iterates and stores indices of the input batch sampler. This helps to start providing data batches from an iteration in a deterministic way.
Example
Setup dataloader with ReproducibleBatchSampler and start providing data batches from an iteration
from ignite.engine.deterministic import update_dataloader dataloader = update_dataloader(dataloader, ReproducibleBatchSampler(dataloader.batch_sampler)) # rewind dataloader to a specific iteration: dataloader.batch_sampler.start_iteration = start_iteration
- Parameters
batch_sampler (BatchSampler) – batch sampler same as used with torch.utils.data.DataLoader.
Methods
Setup batch indices.