public abstract static class RandomAccessDataset.BaseBuilder<T extends RandomAccessDataset.BaseBuilder<T>>
extends java.lang.Object
RandomAccessDataset.| Modifier and Type | Field and Description |
|---|---|
protected Batchifier |
dataBatchifier |
protected Device |
device |
protected java.util.concurrent.ExecutorService |
executor |
protected Batchifier |
labelBatchifier |
protected long |
limit |
protected Pipeline |
pipeline |
protected int |
prefetchNumber |
protected Sampler |
sampler |
protected Pipeline |
targetPipeline |
| Constructor and Description |
|---|
BaseBuilder() |
| Modifier and Type | Method and Description |
|---|---|
T |
addTargetTransform(Transform transform)
|
T |
addTransform(Transform transform)
|
Sampler |
getSampler()
Gets the
Sampler for the dataset. |
T |
optDataBatchifier(Batchifier dataBatchifier)
Sets the
Batchifier for the data. |
T |
optDevice(Device device)
Sets the
Device. |
T |
optExecutor(java.util.concurrent.ExecutorService executor,
int prefetchNumber)
Sets the
ExecutorService to spawn threads to fetch data. |
T |
optLabelBatchifier(Batchifier labelBatchifier)
Sets the
Batchifier for the labels. |
T |
optLimit(long limit)
Sets this dataset's limit.
|
T |
optPipeline(Pipeline pipeline)
|
T |
optTargetPipeline(Pipeline targetPipeline)
|
protected abstract T |
self()
Returns this {code Builder} object.
|
T |
setSampling(int batchSize,
boolean random)
Sets the
Sampler with the given batch size. |
T |
setSampling(int batchSize,
boolean random,
boolean dropLast)
Sets the
Sampler with the given batch size. |
T |
setSampling(Sampler sampler)
Sets the
Sampler for the dataset. |
protected Sampler sampler
protected Batchifier dataBatchifier
protected Batchifier labelBatchifier
protected Pipeline pipeline
protected Pipeline targetPipeline
protected java.util.concurrent.ExecutorService executor
protected int prefetchNumber
protected long limit
protected Device device
public T setSampling(int batchSize, boolean random)
Sampler with the given batch size.batchSize - the batch sizerandom - whether the sampling has to be randomBaseBuilderpublic T setSampling(int batchSize, boolean random, boolean dropLast)
Sampler with the given batch size.batchSize - the batch sizerandom - whether the sampling has to be randomdropLast - whether to drop the last incomplete batchBaseBuilderpublic T setSampling(Sampler sampler)
Sampler for the dataset.sampler - the Sampler to be setBaseBuilderpublic T optDataBatchifier(Batchifier dataBatchifier)
Batchifier for the data.dataBatchifier - the Batchifier to be setBaseBuilderpublic T optLabelBatchifier(Batchifier labelBatchifier)
Batchifier for the labels.labelBatchifier - the Batchifier to be setBaseBuilderpublic T addTransform(Transform transform)
transform - the Transform to be addedpublic T addTargetTransform(Transform transform)
transform - the Transform to be addedpublic T optExecutor(java.util.concurrent.ExecutorService executor, int prefetchNumber)
ExecutorService to spawn threads to fetch data.executor - the ExecutorService to spawn threadsprefetchNumber - the number of samples to prefetch at onceBaseBuilderpublic T optDevice(Device device)
Device.device - the deviceBaseBuilderpublic T optLimit(long limit)
The limit is usually used for testing purposes to test only with a subset of the dataset.
limit - the limit of this dataset's recordsBaseBuilderprotected abstract T self()
BaseBuilder