repeat
Dataset wrapper that lengthens an epoch by repeating an underlying dataset.
Classes:
-
RepeatDatasetβRepeats a dataset
ktimes so one epoch iterates itktimes. -
RepeatSamplerβDraws every sample of a dataset its own number of times per epoch.
RepeatDataset [source] ΒΆ
Bases: Dataset
Repeats a dataset k times so one epoch iterates it k times.
Lengthens an epoch (and thus the number of optimizer steps per epoch) without otherwise changing training.
Parameters:
-
dataset(Dataset) βThe dataset to repeat.
-
k(int) βNumber of times the dataset is iterated per epoch.
RepeatSampler [source] ΒΆ
RepeatSampler(
counts: Sequence[int],
shuffle: bool = True,
generator: Optional[Generator] = None,
)
Bases: Sampler[int]
Draws every sample of a dataset its own number of times per epoch.
An epoch yields index \(i\) counts[i] times, shuffled unless shuffle is off, so unevenly sized samples can be visited in proportion to their size (large scenes more often than small ones).
Parameters:
-
counts(Sequence[int]) βNumber of draws per epoch of every sample, one non-negative count per dataset index.
-
shuffle(bool, default:True) βShuffle the draws;
Falseyields them grouped by sample, in index order. -
generator(Optional[Generator], default:None) βRandom generator of the shuffle;
Noneuses the global one.