Example usage for org.deeplearning4j.nn.multilayer MultiLayerNetwork setInput

List of usage examples for org.deeplearning4j.nn.multilayer MultiLayerNetwork setInput

Introduction

In this page you can find the example usage for org.deeplearning4j.nn.multilayer MultiLayerNetwork setInput.

Prototype

public void setInput(INDArray input) 

Source Link

Document

Set the input array for the network

Usage

From source file:org.knime.ext.dl4j.base.nodes.learn.AbstractDLLearnerNodeModel.java

License:Open Source License

/**
 * Performs one epoch of finetuning of the specified {@link MultiLayerNetwork}. Checks {@link LearningMonitor} of
 * this learner if learning should be prematurely stopped.
 *
 * @param mln the network to train//from   w w w.j  a  va2  s . c o m
 * @param data the data to train on
 * @param exec used to check for cancelled execution and stop learning
 * @throws CanceledExecutionException
 */
protected void finetuneOneEpoch(final MultiLayerNetwork mln, final DataSetIterator data,
        final ExecutionContext exec) throws CanceledExecutionException {
    exec.setMessage("Performing Finetuning");
    while (data.hasNext()) {
        exec.checkCanceled();
        if (m_learningMonitor.checkStopLearning()) {
            break;
        }

        final DataSet next = data.next();
        if ((next.getFeatureMatrix() == null) || (next.getLabels() == null)) {
            break;
        }
        mln.setInput(next.getFeatureMatrix());
        mln.setLabels(next.getLabels());
        mln.finetune();
    }
}