private void DeepLearningNet(Sequence pSequence, SimpleLayer[] seqOutput, List <double[][]> fErrLayers, List <double[][]> bErrLayers, List <SimpleLayer[]> layerList) { int numStates = pSequence.States.Length; int numLayers = forwardHiddenLayers.Count; //Learning output layer Parallel.Invoke(() => { for (int curState = 0; curState < numStates; curState++) { seqOutput[curState].LearnFeatureWeights(numStates, curState); } }, () => { Parallel.For(0, numLayers, parallelOption, i => { Parallel.Invoke(() => { SimpleLayer forwardLayer = forwardHiddenLayers[i]; forwardLayer.netReset(true); for (int curState = 0; curState < numStates; curState++) { forwardLayer.computeLayer(layerList[i][curState].SparseFeature, layerList[i][curState].DenseFeature, true); forwardLayer.er = fErrLayers[i][curState]; forwardLayer.LearnFeatureWeights(numStates, curState); } }, () => { SimpleLayer backwardLayer = backwardHiddenLayers[i]; backwardLayer.netReset(true); for (int curState = 0; curState < numStates; curState++) { int curState2 = numStates - curState - 1; backwardLayer.computeLayer(layerList[i][curState2].SparseFeature, layerList[i][curState2].DenseFeature, true); backwardLayer.er = bErrLayers[i][curState2]; backwardLayer.LearnFeatureWeights(numStates, curState); } }); }); }); }