Shortcuts

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.

Parameters
  • batch_sampler (BatchSampler) – batch sampler same as used with torch.utils.data.DataLoader.

  • start_iteration (Optional[int]) – optional start iteration.

Examples

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

Methods

setup_batch_indices

Setup batch indices.

setup_batch_indices()[source]#

Setup batch indices.

Return type

None