Package ai.djl.training.dataset
Class RandomAccessDataset.BaseBuilder<T extends RandomAccessDataset.BaseBuilder<T>>
java.lang.Object
ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T>
- Direct Known Subclasses:
ArrayDataset.Builder
- Enclosing class:
- RandomAccessDataset
public abstract static class RandomAccessDataset.BaseBuilder<T extends RandomAccessDataset.BaseBuilder<T>>
extends Object
The Builder to construct a
RandomAccessDataset
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Batchifier
protected Device
protected Batchifier
protected long
protected Pipeline
protected int
protected Sampler
protected Pipeline
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTargetTransform
(Transform transform) addTransform
(Transform transform) Gets theSampler
for the dataset.optDataBatchifier
(Batchifier dataBatchifier) Sets theBatchifier
for the data.Sets theDevice
.optLabelBatchifier
(Batchifier labelBatchifier) Sets theBatchifier
for the labels.optLimit
(long limit) Sets this dataset's limit.optPipeline
(Pipeline pipeline) optPrefetchNumber
(int prefetchNumber) Sets the number of batches to prefetch at once.optTargetPipeline
(Pipeline targetPipeline) protected abstract T
self()
Returns this {code Builder} object.setSampling
(int batchSize, boolean random) Sets theSampler
with the given batch size.setSampling
(int batchSize, boolean random, boolean dropLast) Sets theSampler
with the given batch size.setSampling
(Sampler sampler) Sets theSampler
for the dataset.
-
Field Details
-
sampler
-
dataBatchifier
-
labelBatchifier
-
pipeline
-
targetPipeline
-
prefetchNumber
protected int prefetchNumber -
limit
protected long limit -
device
-
-
Constructor Details
-
BaseBuilder
public BaseBuilder()
-
-
Method Details
-
getSampler
Gets theSampler
for the dataset.- Returns:
- the
Sampler
-
setSampling
Sets theSampler
with the given batch size.- Parameters:
batchSize
- the batch sizerandom
- whether the sampling has to be random- Returns:
- this
BaseBuilder
-
setSampling
Sets theSampler
with the given batch size.- Parameters:
batchSize
- the batch sizerandom
- whether the sampling has to be randomdropLast
- whether to drop the last incomplete batch- Returns:
- this
BaseBuilder
-
setSampling
Sets theSampler
for the dataset.- Parameters:
sampler
- theSampler
to be set- Returns:
- this
BaseBuilder
-
optDataBatchifier
Sets theBatchifier
for the data.- Parameters:
dataBatchifier
- theBatchifier
to be set- Returns:
- this
BaseBuilder
-
optLabelBatchifier
Sets theBatchifier
for the labels.- Parameters:
labelBatchifier
- theBatchifier
to be set- Returns:
- this
BaseBuilder
-
optPipeline
-
addTransform
- Parameters:
transform
- theTransform
to be added- Returns:
- this builder
-
optTargetPipeline
-
addTargetTransform
- Parameters:
transform
- theTransform
to be added- Returns:
- this builder
-
optPrefetchNumber
Sets the number of batches to prefetch at once.- Parameters:
prefetchNumber
- the number of batches to prefetch at once- Returns:
- this
BaseBuilder
-
optDevice
Sets theDevice
.- Parameters:
device
- the device- Returns:
- this
BaseBuilder
-
optLimit
Sets this dataset's limit.The limit is usually used for testing purposes to test only with a subset of the dataset.
- Parameters:
limit
- the limit of this dataset's records- Returns:
- this
BaseBuilder
-
self
Returns this {code Builder} object.- Returns:
- this
BaseBuilder
-