public class AsyncDataSetIterator
extends java.lang.Object
implements org.nd4j.linalg.dataset.api.iterator.DataSetIterator
PLEASE NOTE: If used together with CUDA backend, please use it with caution.
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
Constructor and Description |
---|
AsyncDataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator baseIterator)
Create an AsyncDataSetIterator with a queue size of 1 (i.e., only load a
single additional DataSet)
|
AsyncDataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator baseIterator,
int queueSize)
Create an AsyncDataSetIterator with a specified queue size.
|
AsyncDataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator iterator,
int queueSize,
java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet> queue)
Create an AsyncDataSetIterator with a queue size of 1 (i.e., only load a
single additional DataSet)
|
Modifier and Type | Method and Description |
---|---|
boolean |
asyncSupported() |
int |
batch() |
int |
cursor() |
java.util.List<java.lang.String> |
getLabels() |
org.nd4j.linalg.dataset.api.DataSetPreProcessor |
getPreProcessor() |
boolean |
hasNext() |
int |
inputColumns() |
org.nd4j.linalg.dataset.DataSet |
next() |
org.nd4j.linalg.dataset.DataSet |
next(int num) |
int |
numExamples() |
void |
remove() |
void |
reset() |
boolean |
resetSupported() |
void |
setPreProcessor(org.nd4j.linalg.dataset.api.DataSetPreProcessor preProcessor) |
void |
shutdown()
Shut down the async data set iterator thread
This is not typically necessary if using a single AsyncDataSetIterator
(thread is a daemon thread and so shouldn't block the JVM from exiting)
Behaviour of next(), hasNext() etc methods after shutdown of async iterator is undefined
|
int |
totalExamples() |
int |
totalOutcomes() |
public AsyncDataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator baseIterator)
baseIterator
- The DataSetIterator to load data from asynchronouslypublic AsyncDataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator iterator, int queueSize, java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet> queue)
iterator
- queueSize
- queue
- BlockingQueue instance that will be used as backing queue. MagicQueue probably?public AsyncDataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator baseIterator, int queueSize)
baseIterator
- The DataSetIterator to load data from asynchronouslyqueueSize
- size of the queue (max number of elements to load into queue)public org.nd4j.linalg.dataset.DataSet next(int num)
next
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int totalExamples()
totalExamples
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int inputColumns()
inputColumns
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int totalOutcomes()
totalOutcomes
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public boolean resetSupported()
resetSupported
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public boolean asyncSupported()
asyncSupported
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public void reset()
reset
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int batch()
batch
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int cursor()
cursor
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int numExamples()
numExamples
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public void setPreProcessor(org.nd4j.linalg.dataset.api.DataSetPreProcessor preProcessor)
setPreProcessor
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public org.nd4j.linalg.dataset.api.DataSetPreProcessor getPreProcessor()
getPreProcessor
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public java.util.List<java.lang.String> getLabels()
getLabels
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public boolean hasNext()
hasNext
in interface java.util.Iterator<org.nd4j.linalg.dataset.DataSet>
public org.nd4j.linalg.dataset.DataSet next()
next
in interface java.util.Iterator<org.nd4j.linalg.dataset.DataSet>
public void shutdown()
public void remove()
remove
in interface java.util.Iterator<org.nd4j.linalg.dataset.DataSet>