code: def __init__(
      self,
      *,
      sample_count: int,
      shuffle: bool = False,
      seed: int = 0,
      start: Optional[int] = None,
      step: Optional[int] = None,
      advance: int = 0,
      use_new_shuffle_tensor_slice: bool = False,
  ):
      self._sample_count = sample_count
      self._seed = seed
      self._shuffle = shuffle
      self._start = (
          distributed.get_global_rank() if start is None else start
      )
      self._step = (
          distributed.get_global_size() if step is None else step
      )
      self._advance = advance
      self._iter_count = 0
      self._shuffle_tensor_slice_fn = (
          _new_shuffle_tensor_slice
          if use_new_shuffle_tensor_slice
          else _shuffle_tensor_slice
      )
  
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 1 to create a new ShardedInfiniteSampler object from inherited base classes: Sampler with example: obj = ShardedInfiniteSampler()