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 randomBaseBuilder
public 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 batchBaseBuilder
public T setSampling(Sampler sampler)
Sampler
for the dataset.sampler
- the Sampler
to be setBaseBuilder
public T optDataBatchifier(Batchifier dataBatchifier)
Batchifier
for the data.dataBatchifier
- the Batchifier
to be setBaseBuilder
public T optLabelBatchifier(Batchifier labelBatchifier)
Batchifier
for the labels.labelBatchifier
- the Batchifier
to be setBaseBuilder
public 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 onceBaseBuilder
public T optDevice(Device device)
Device
.device
- the deviceBaseBuilder
public 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 recordsBaseBuilder
protected abstract T self()
BaseBuilder