code: def _shuffled_iterator(self):
      assert self._shuffle
  
      # Instantiate a generator here (rather than in the ctor) to be keep the class
      # picklable (requirement of mp.spawn)
      generator = torch.Generator()
  
      # Always shuffle everything first
      generator.manual_seed(self._seed)
      dtype = _get_torch_dtype(self._sample_count)
      perm = torch.randperm(
          self._sample_count, dtype=dtype, generator=generator
      )
  
      while True:
          # Re-seed on each iteration to allow skipping whole permutations
          seed = _make_seed(self._seed, self._start, self._iter_count)
          generator.manual_seed(seed)
  
          iterable = self._shuffle_tensor_slice_fn(
              tensor=perm,
              start=self._start,
              step=self._step,
              generator=generator,
          )
          yield from iterable
          self._iter_count += 1
  
imports: import itertools
  from typing import Any, Optional
  import warnings
  import numpy
  import torch
  from torch.utils.data.sampler import Sampler
  import dinov2.distributed
label_desc: Use image node_id 4 for calling the ShardedInfiniteSampler obj's underlying member method code with example usage: obj._shuffled_iterator() without return types