class_docstr: Non shuffling Distributed Sampler
class_docstr_tok: ["Non","shuffling","Distributed","Sampler"]
code: def __init__(self, dataset, num_replicas=None, rank=None):
      super(DistributedSampler, self).__init__(dataset)
      if num_replicas is None:
          if not dist.is_available():
              raise RuntimeError(
                  "Requires distributed package to be available"
              )
          num_replicas = dist.get_world_size()
      if rank is None:
          if not dist.is_available():
              raise RuntimeError(
                  "Requires distributed package to be available"
              )
          rank = dist.get_rank()
      self.dataset = dataset
      self.num_replicas = num_replicas
      self.rank = rank
      self.epoch = 0
      self.num_samples = int(
          math.ceil(len(self.dataset) * 1.0 / self.num_replicas)
      )
      self.total_size = self.num_samples * self.num_replicas
  
file_path: TTS/TTS/utils/distribute.py
imports: import math
  import torch
  import torch.distributed
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
  from torch.autograd import Variable
  from torch.utils.data.sampler import Sampler
label_desc: Use image node_id 1 to create a new DistributedSampler object from inherited base classes: Sampler with example: obj = DistributedSampler(dataset, num_replicas, rank)