Package ai.djl.training.dataset
Class BulkDataIterable
java.lang.Object
ai.djl.training.dataset.DataIterable
ai.djl.training.dataset.BulkDataIterable
BulkDataIterable specializes DataIterable in using
ArrayDataset.getByRange(NDManager, long, long) or ArrayDataset.getByIndices(NDManager, long...) to create Batch
instances more efficiently.-
Field Summary
Fields inherited from class ai.djl.training.dataset.DataIterable
dataBatchifier, dataset, device, labelBatchifier, manager, pipeline, targetPipeline -
Constructor Summary
ConstructorsConstructorDescriptionBulkDataIterable(ArrayDataset dataset, NDManager manager, Sampler sampler, Batchifier dataBatchifier, Batchifier labelBatchifier, Pipeline pipeline, Pipeline targetPipeline, ExecutorService executor, int preFetchNumber, Device device) Creates a new instance ofBulkDataIterablewith the given parameters. -
Method Summary
Methods inherited from class ai.djl.training.dataset.DataIterable
hasNext, iterator, nextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
BulkDataIterable
public BulkDataIterable(ArrayDataset dataset, NDManager manager, Sampler sampler, Batchifier dataBatchifier, Batchifier labelBatchifier, Pipeline pipeline, Pipeline targetPipeline, ExecutorService executor, int preFetchNumber, Device device) Creates a new instance ofBulkDataIterablewith the given parameters.- Parameters:
dataset- the dataset to iterate onmanager- the manager to create the arrayssampler- a sampler to sample data withdataBatchifier- a batchifier for datalabelBatchifier- a batchifier for labelspipeline- the pipeline of transforms to apply on the datatargetPipeline- the pipeline of transforms to apply on the labelsexecutor- anExecutorServicepreFetchNumber- the number of samples to prefetchdevice- theDevice
-
-
Method Details
-
fetch
- Overrides:
fetchin classDataIterable- Throws:
IOException
-
isRange
Checks whether the given indices actually represents a range.- Parameters:
indices- the indices to examine- Returns:
- whether the given indices are sorted in ascending order with no gap and has at least one element
-