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.

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 – batch sampler same as used with torch.utils.data.DataLoader.

  • start_iteration – optional start iteration.

Methods

setup_batch_indices

Setup batch indices.

setup_batch_indices()[source]

Setup batch indices.

Return type

None