def get_train_sampler(self):
        """
        Returns class:`~torch.utils.data.DistributedSampler`.
        Will use no sampler if :obj:`test_dataset` is a :obj:`torch.utils.data.IterableDataset`, a sequential sampler.
        """
        if isinstance(self.train_dataset, torch.utils.data.IterableDataset):
            return None
        else:
            return torch.utils.data.distributed.DistributedSampler(self.train_dataset)

        Returns class:`~torch.utils.data.DistributedSampler`.
        Will use no sampler if :obj:`test_dataset` is a :obj:`torch.utils.data.IterableDataset`, a sequential sampler.
        
intel_extension_for_pytorch/xpu/single_card.py