class_docstr: Wrapper over ``Sampler`` for distributed training.
  
  Allows you to use any sampler in distributed mode. It will be automatically used by Lightning in distributed mode if
  sampler replacement is enabled.
  
  Note:
      The purpose of this wrapper is to take care of sharding the sampler indices. It is up to the underlying
      sampler to handle randomness and shuffling. The ``shuffle`` and ``seed`` arguments on this wrapper won't
      have any effect.
code: def __init__(
      self, sampler: Union[Sampler, Iterable], *args: Any, **kwargs: Any
  ) -> None:
      super().__init__(_DatasetSamplerWrapper(sampler), *args, **kwargs)
  
imports: import contextlib
  import logging
  import os
  import time
  from contextlib import nullcontext
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Optional, Sized, Union
  import torch
  import torch.nn.functional
  from lightning_utilities.core.imports import package_available
  from torch import Tensor
  from torch.utils.data import Dataset, DistributedSampler, Sampler
  from typing_extensions import override
  from lightning.fabric.utilities.cloud_io import _is_local_file_protocol
  from lightning.fabric.utilities.data import _num_cpus_available
  from lightning.fabric.utilities.rank_zero import rank_zero_info
  from lightning.fabric.utilities.types import _PATH, ReduceOp
label_desc: Use image node_id 1 to create a new DistributedSamplerWrapper object from inherited base classes: DistributedSampler with example: obj = DistributedSamplerWrapper(sampler)