src/core/layer/AbstractLayer.java
public void run() {
        while (true) {
            executeLock.lock();
            if (executionState == ExecutionState.IDLE || executionState == ExecutionState.EXECUTING) executeLockCondition.awaitUninterruptibly();
            try {
                switch (executionState) {
                    case TRAIN:
                        setTraining(true);
                        forwardProcess();
                        if (hasNextLayer()) getNextLayer().train();
                        else if (hasPreviousLayer()) getPreviousLayer().stateCompleted(false);
                        break;
                    case PREDICT:
                        setTraining(false);
                        forwardProcess();
                        if (hasNextLayer()) getNextLayer().predict();
                        else if (hasPreviousLayer()) getPreviousLayer().stateCompleted(false);
                        break;
                    case BACKWARD:
                        if (hasPreviousLayer()) {
                            backwardProcess();
                            getPreviousLayer().backward();
                        }
                        else if (hasNextLayer()) getNextLayer().stateCompleted(true);
                        break;
                    case UPDATE:
                        optimize();
                        if (hasNextLayer()) getNextLayer().update();
                        else if (hasPreviousLayer()) getPreviousLayer().stateCompleted(false);
                        break;
                    case TERMINATED:
                        if (hasNextLayer()) getNextLayer().stop();
                        layerThread = null;
                        executionState = ExecutionState.IDLE;
                        executeLock.unlock();
                        return;
                }
            }
            catch (Exception exception) {
                exception.printStackTrace();
                System.exit(-1);
            }
            executionState = ExecutionState.EXECUTING;
            executeLock.unlock();
        }
    }
/**
     * Thread run function.<br>
     * Executes given neural network procedures and synchronizes their execution via layer thread execution lock.<br>
     *
     */
Thread run function.
Executes given neural network procedures and synchronizes their execution via layer thread execution lock.
Thread run function . Executes given neural network procedures and synchronizes their execution via layer thread execution lock .
public void run() {
        while (true) {
            executeLock.lock();
            if (executionState == ExecutionState.IDLE || executionState == ExecutionState.EXECUTING) executeLockCondition.awaitUninterruptibly();
            try {
                switch (executionState) {
                    case TRAIN:
                        setTraining(true);
                        forwardProcess();
                        if (hasNextLayer()) getNextLayer().train();
                        else if (hasPreviousLayer()) getPreviousLayer().stateCompleted(false);
                        break;
                    case PREDICT:
                        setTraining(false);
                        forwardProcess();
                        if (hasNextLayer()) getNextLayer().predict();
                        else if (hasPreviousLayer()) getPreviousLayer().stateCompleted(false);
                        break;
                    case BACKWARD:
                        if (hasPreviousLayer()) {
                            backwardProcess();
                            getPreviousLayer().backward();
                        }
                        else if (hasNextLayer()) getNextLayer().stateCompleted(true);
                        break;
                    case UPDATE:
                        optimize();
                        if (hasNextLayer()) getNextLayer().update();
                        else if (hasPreviousLayer()) getPreviousLayer().stateCompleted(false);
                        break;
                    case TERMINATED:
                        if (hasNextLayer()) getNextLayer().stop();
                        layerThread = null;
                        executionState = ExecutionState.IDLE;
                        executeLock.unlock();
                        return;
                }
            }
            catch (Exception exception) {
                exception.printStackTrace();
                System.exit(-1);
            }
            executionState = ExecutionState.EXECUTING;
            executeLock.unlock();
        }
    }
public void run ( ) { while ( true ) { executeLock . lock ( ) ; if ( executionState == ExecutionState . IDLE || executionState == ExecutionState . EXECUTING ) executeLockCondition . awaitUninterruptibly ( ) ; try { switch ( executionState ) { case TRAIN : setTraining ( true ) ; forwardProcess ( ) ; if ( hasNextLayer ( ) ) getNextLayer ( ) . train ( ) ; else if ( hasPreviousLayer ( ) ) getPreviousLayer ( ) . stateCompleted ( false ) ; break ; case PREDICT : setTraining ( false ) ; forwardProcess ( ) ; if ( hasNextLayer ( ) ) getNextLayer ( ) . predict ( ) ; else if ( hasPreviousLayer ( ) ) getPreviousLayer ( ) . stateCompleted ( false ) ; break ; case BACKWARD : if ( hasPreviousLayer ( ) ) { backwardProcess ( ) ; getPreviousLayer ( ) . backward ( ) ; } else if ( hasNextLayer ( ) ) getNextLayer ( ) . stateCompleted ( true ) ; break ; case UPDATE : optimize ( ) ; if ( hasNextLayer ( ) ) getNextLayer ( ) . update ( ) ; else if ( hasPreviousLayer ( ) ) getPreviousLayer ( ) . stateCompleted ( false ) ; break ; case TERMINATED : if ( hasNextLayer ( ) ) getNextLayer ( ) . stop ( ) ; layerThread = null ; executionState = ExecutionState . IDLE ; executeLock . unlock ( ) ; return ; } } catch ( Exception exception ) { exception . printStackTrace ( ) ; System . exit ( - 1 ) ; } executionState = ExecutionState . EXECUTING ; executeLock . unlock ( ) ; } }
Thread run function.<br>
 Executes given neural network procedures and synchronizes their execution via layer thread execution lock.<br>
Thread run function . <br > Executes given neural network procedures and synchronizes their execution via layer thread execution lock . <br >