RepeatedRandomSampler#
- class stable_ssl.data.RepeatedRandomSampler(data_source_or_len: int | Iterable, n_views: int = 1, replacement: bool = False, seed: int = 0)[source]#
Bases:
DistributedSampler
Samples elements randomly. If without replacement, then sample from a shuffled dataset.
If with replacement, then user can specify
num_samples
to draw.- Parameters:
data_source (Dataset) – dataset to sample from
n_views (int) – number of views to repeat each sample, default=1
replacement (bool) – samples are drawn on-demand with replacement if
True
, default=``False``num_samples (int) – number of samples to draw, default=`len(dataset)`.
generator (Generator) – Generator used in sampling.