Search in sources :

Example 6 with AsyncDataSetIterator

use of org.deeplearning4j.datasets.iterator.AsyncDataSetIterator in project deeplearning4j by deeplearning4j.

the class ParameterServerParallelWrapper method fit.

public void fit(DataSetIterator source) {
    if (!init)
        init(source);
    DataSetIterator iterator;
    if (preFetchSize > 0 && source.asyncSupported())
        iterator = new AsyncDataSetIterator(source, preFetchSize);
    else
        iterator = source;
    for (int i = 0; i < numEpochs; i++) {
        while (iterator.hasNext()) {
            DataSet next = iterator.next();
            addObject(next);
        }
        iterator.reset();
        log.info(String.format("Completed epoch %d", i));
    }
}
Also used : DataSet(org.nd4j.linalg.dataset.DataSet) MultiDataSet(org.nd4j.linalg.dataset.MultiDataSet) AsyncDataSetIterator(org.deeplearning4j.datasets.iterator.AsyncDataSetIterator) DataSetIterator(org.nd4j.linalg.dataset.api.iterator.DataSetIterator) AsyncDataSetIterator(org.deeplearning4j.datasets.iterator.AsyncDataSetIterator) MultiDataSetIterator(org.nd4j.linalg.dataset.api.iterator.MultiDataSetIterator) AsyncMultiDataSetIterator(org.deeplearning4j.datasets.iterator.AsyncMultiDataSetIterator)

Aggregations

AsyncDataSetIterator (org.deeplearning4j.datasets.iterator.AsyncDataSetIterator)6 DataSetIterator (org.nd4j.linalg.dataset.api.iterator.DataSetIterator)5 DataSet (org.nd4j.linalg.dataset.DataSet)4 AsyncMultiDataSetIterator (org.deeplearning4j.datasets.iterator.AsyncMultiDataSetIterator)3 MultiDataSetIterator (org.nd4j.linalg.dataset.api.iterator.MultiDataSetIterator)3 ComputationGraph (org.deeplearning4j.nn.graph.ComputationGraph)2 MultiLayerNetwork (org.deeplearning4j.nn.multilayer.MultiLayerNetwork)2 Solver (org.deeplearning4j.optimize.Solver)2 TrainingListener (org.deeplearning4j.optimize.api.TrainingListener)2 INDArray (org.nd4j.linalg.api.ndarray.INDArray)2 DataSet (org.nd4j.linalg.dataset.api.DataSet)2 MultiDataSet (org.nd4j.linalg.dataset.api.MultiDataSet)2 ArrayList (java.util.ArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ExistingDataSetIterator (org.deeplearning4j.datasets.iterator.ExistingDataSetIterator)1 IteratorDataSetIterator (org.deeplearning4j.datasets.iterator.IteratorDataSetIterator)1 SingletonMultiDataSetIterator (org.deeplearning4j.datasets.iterator.impl.SingletonMultiDataSetIterator)1 Updater (org.deeplearning4j.nn.api.Updater)1 ComputationGraphUpdater (org.deeplearning4j.nn.updater.graph.ComputationGraphUpdater)1 WorkerConfiguration (org.deeplearning4j.spark.api.WorkerConfiguration)1