class_docstr: 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.
  
  Args:
      batch_sampler: batch sampler same as used with `torch.utils.data.DataLoader`.
      start_iteration: optional start iteration.
  
  Examples:
      Setup dataloader with `ReproducibleBatchSampler` and start providing data batches from an iteration
  
      .. code-block:: python
  
          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
class_docstr_tok: ["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",".","Args",":","batch_sampler",":","batch","sampler","same","as","used","with","`","torch.utils.data.DataLoader","`",".","start_iteration",":","optional","start","iteration",".","Examples",":","Setup","dataloader","with","`","ReproducibleBatchSampler","`","and","start","providing","data","batches","from","an","iteration","..","code-block",":",":","python","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"]
code: def __init__(
      self,
      batch_sampler: BatchSampler,
      start_iteration: Optional[int] = None,
  ):
      if not isinstance(batch_sampler, BatchSampler):
          raise TypeError(
              "Argument batch_sampler should be torch.utils.data.sampler.BatchSampler"
          )
  
      self.batch_indices: List = []
      self.batch_sampler = batch_sampler
      self.start_iteration = start_iteration
      self.sampler = self.batch_sampler.sampler
  
imports: import random
  import warnings
  from collections import OrderedDict
  from functools import wraps
  from typing import Any, Callable, Generator, Iterator, List, Optional
  import torch
  from torch.utils.data import DataLoader
  from torch.utils.data.sampler import BatchSampler
  from ignite.engine.engine import Engine
  from ignite.engine.events import Events
  from ignite.utils import manual_seed
label_desc: Use image node_id 1 to create a new ReproducibleBatchSampler object from inherited base classes: BatchSampler with example: obj = ReproducibleBatchSampler(batch_sampler, start_iteration)