scvi.dataloaders.BatchDistributedSampler#
- class scvi.dataloaders.BatchDistributedSampler(dataset, batch_size=128, drop_last=False, drop_dataset_tail=False, **kwargs)[source]#
Bases:
DistributedSamplerEXPERIMENTALSampler that restricts to loading from a subset of the dataset.In contrast to
DistributedSampler, retrieves a minibatch of data with one call to the dataset’s__getitem__for efficient access to sparse data.- Parameters:
- dataset
Dataset Datasetinstance to sample from.- batch_size
int(default:128) Minibatch size to load each iteration for each replica. Thus, the effective minibatch size is
batch_size*num_replicas.- drop_last
bool(default:False) If
Trueand the dataset is not evenly divisible bybatch_size, the last incomplete batch is dropped. IfFalseand the dataset is not evenly divisible bybatch_size, then the last batch will be smaller thanbatch_size.- drop_dataset_tail
bool(default:False) If
Truethe sampler will drop the tail of the dataset to make it evenly divisible by the number of replicas. IfFalse, then the sampler will add extra indices to make the dataset evenly divisible by the number of replicas.- **kwargs
Additional keyword arguments passed into
DistributedSampler.
- dataset