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 Batchifierprotected Deviceprotected Batchifierprotected longprotected Pipelineprotected intprotected Samplerprotected Pipeline -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTargetTransform(Transform transform) addTransform(Transform transform) Gets theSamplerfor the dataset.optDataBatchifier(Batchifier dataBatchifier) Sets theBatchifierfor the data.Sets theDevice.optLabelBatchifier(Batchifier labelBatchifier) Sets theBatchifierfor 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 Tself()Returns this {code Builder} object.setSampling(int batchSize, boolean random) Sets theSamplerwith the given batch size.setSampling(int batchSize, boolean random, boolean dropLast) Sets theSamplerwith the given batch size.setSampling(Sampler sampler) Sets theSamplerfor 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 theSamplerfor the dataset.- Returns:
- the
Sampler
-
setSampling
Sets theSamplerwith the given batch size.- Parameters:
batchSize- the batch sizerandom- whether the sampling has to be random- Returns:
- this
BaseBuilder
-
setSampling
Sets theSamplerwith 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 theSamplerfor the dataset.- Parameters:
sampler- theSamplerto be set- Returns:
- this
BaseBuilder
-
optDataBatchifier
Sets theBatchifierfor the data.- Parameters:
dataBatchifier- theBatchifierto be set- Returns:
- this
BaseBuilder
-
optLabelBatchifier
Sets theBatchifierfor the labels.- Parameters:
labelBatchifier- theBatchifierto be set- Returns:
- this
BaseBuilder
-
optPipeline
-
addTransform
- Parameters:
transform- theTransformto be added- Returns:
- this builder
-
optTargetPipeline
-
addTargetTransform
- Parameters:
transform- theTransformto 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
-