Package ai.djl.training.dataset
Class RandomSampler
- java.lang.Object
-
- ai.djl.training.dataset.RandomSampler
-
- All Implemented Interfaces:
Sampler.SubSampler
public class RandomSampler extends java.lang.Object implements Sampler.SubSampler
RandomSampler
is an implementation of theSampler.SubSampler
interface.RandomSampler
samples the data from [0, dataset.size) randomly.
-
-
Constructor Summary
Constructors Constructor Description RandomSampler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<java.lang.Long>
sample(RandomAccessDataset dataset)
Fetches an iterator that iterates through the indices of the givenRandomAccessDataset
.
-
-
-
Method Detail
-
sample
public java.util.Iterator<java.lang.Long> sample(RandomAccessDataset dataset)
Fetches an iterator that iterates through the indices of the givenRandomAccessDataset
.- Specified by:
sample
in interfaceSampler.SubSampler
- Parameters:
dataset
- theRandomAccessDataset
to sample from- Returns:
- an iterator that iterates through the indices of the given
RandomAccessDataset
-
-