public abstract class RandomAccessDataset extends java.lang.Object implements Dataset, java.util.RandomAccess
| Modifier and Type | Class and Description |
|---|---|
static class |
RandomAccessDataset.BaseBuilder<T extends RandomAccessDataset.BaseBuilder>
The Builder to construct a
RandomAccessDataset. |
Dataset.Usage| Modifier and Type | Field and Description |
|---|---|
protected Batchifier |
batchifier |
protected Device |
device |
protected java.util.concurrent.ExecutorService |
executor |
protected long |
maxIteration |
protected Pipeline |
pipeline |
protected int |
prefetchNumber |
protected Sampler |
sampler |
protected Pipeline |
targetPipeline |
| Constructor and Description |
|---|
RandomAccessDataset(RandomAccessDataset.BaseBuilder<?> builder)
Creates a new instance of
RandomAccessDataset with the given necessary
configurations. |
| Modifier and Type | Method and Description |
|---|---|
abstract Record |
get(NDManager manager,
long index)
Gets the
Record for the given index from the dataset. |
java.lang.Iterable<Batch> |
getData(NDManager manager)
Fetches an iterator that can iterate through the
Dataset. |
long |
getNumIterations()
Returns the number of iteration of the batch iterable.
|
RandomAccessDataset[] |
randomSplit(int... ratio)
Splits the dataset set into multiple portions.
|
abstract long |
size()
Returns the size of this
Dataset. |
protected Sampler sampler
protected Batchifier batchifier
protected Pipeline pipeline
protected Pipeline targetPipeline
protected java.util.concurrent.ExecutorService executor
protected int prefetchNumber
protected long maxIteration
protected Device device
public RandomAccessDataset(RandomAccessDataset.BaseBuilder<?> builder)
RandomAccessDataset with the given necessary
configurations.builder - a builder with the necessary configurationspublic abstract Record get(NDManager manager, long index) throws java.io.IOException
Record for the given index from the dataset.manager - the manager used to create the arraysindex - the index of the requested data itemRecord that contains the data and label of the requested data itemjava.io.IOException - if an I/O error occurspublic java.lang.Iterable<Batch> getData(NDManager manager)
Dataset.public abstract long size()
Dataset.Datasetpublic long getNumIterations()
public RandomAccessDataset[] randomSplit(int... ratio)
ratio - the ratio of each sub dataset