public abstract static class RandomAccessDataset.BaseBuilder<T extends RandomAccessDataset.BaseBuilder>
extends java.lang.Object
RandomAccessDataset
.Modifier and Type | Field and Description |
---|---|
protected Batchifier |
batchifier |
protected Device |
device |
protected java.util.concurrent.ExecutorService |
executor |
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 |
---|---|
Sampler |
getSampler()
Gets the
Sampler for the dataset. |
T |
optBatchier(Batchifier batchier)
Sets the
Batchifier for the dataset. |
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 |
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 batchifier
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 optBatchier(Batchifier batchier)
Batchifier
for the dataset.batchier
- the Batchifier
to be setBaseBuilder
public 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