basicsr.data.data_sampler¶
- class basicsr.data.data_sampler.EnlargedSampler(dataset, num_replicas, rank, ratio=1)[source]¶
Bases:
Sampler
Sampler that restricts data loading to a subset of the dataset.
Modified from torch.utils.data.distributed.DistributedSampler Support enlarging the dataset for iteration-based training, for saving time when restart the dataloader after each epoch
- Parameters:
dataset (torch.utils.data.Dataset) – Dataset used for sampling.
num_replicas (int | None) – Number of processes participating in the training. It is usually the world_size.
rank (int | None) – Rank of the current process within num_replicas.
ratio (int) – Enlarging ratio. Default: 1.