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"]
docstr: Setup batch indices.
docstr_tok: ["Setup","batch","indices","."]
code: def setup_batch_indices(self) -> None:
      """Setup batch indices."""
      self.batch_indices = []
      for batch in self.batch_sampler:
          self.batch_indices.append(batch)
  
      if self.start_iteration is not None:
          self.batch_indices = self.batch_indices[
              self.start_iteration :
          ]
          self.start_iteration = None
  
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 2 for calling the ReproducibleBatchSampler obj's underlying member method code with example usage: obj.setup_batch_indices() without return types