src/utils/procedure/Procedure.java
public void calculateGradientPerSample(Sequence outputGradientSequence, Sequence inputGradientSequence, int numberOfGradientSteps) throws MatrixException, DynamicParamException {
        Set<Integer> inputKeySet = reversedInput ? outputGradientSequence.keySet() : outputGradientSequence.descendingKeySet();
        int lastKey = reversedInput ? outputGradientSequence.firstKey() : outputGradientSequence.lastKey();

        int gradientStepCount = 0;
        for (Integer sampleIndex : inputKeySet) {
            setOutputSampleGradient(sampleIndex, outputGradientSequence.get(sampleIndex));

            gradientChain.calculateGradientStep(sampleIndex, lastKey);

            inputGradientSequence.put(sampleIndex, setInputSampleGradient(sampleIndex));
            if (numberOfGradientSteps > 0 && ++gradientStepCount >= numberOfGradientSteps) break;
        }
    }
/**
     * Calculates chain of backward expressions for multiple inputs per gradient expression step per sample.
     *
     * @param outputGradientSequence output gradients.
     * @param inputGradientSequence input gradients.
     * @param numberOfGradientSteps number of steps calculated backwards.
     * @throws MatrixException throws exception if calculation fails.
     * @throws DynamicParamException throws exception if parameter (params) setting fails.
     */
Calculates chain of backward expressions for multiple inputs per gradient expression step per sample.

@param outputGradientSequence output gradients.
@param inputGradientSequence input gradients.
@param numberOfGradientSteps number of steps calculated backwards.
@throws MatrixException throws exception if calculation fails.
@throws DynamicParamException throws exception if parameter (params) setting fails.
Calculates chain of backward expressions for multiple inputs per gradient expression step per sample . @param outputGradientSequence output gradients . @param inputGradientSequence input gradients . @param numberOfGradientSteps number of steps calculated backwards . @throws MatrixException throws exception if calculation fails . @throws DynamicParamException throws exception if parameter ( params ) setting fails .
public void calculateGradientPerSample(Sequence outputGradientSequence, Sequence inputGradientSequence, int numberOfGradientSteps) throws MatrixException, DynamicParamException {
        Set<Integer> inputKeySet = reversedInput ? outputGradientSequence.keySet() : outputGradientSequence.descendingKeySet();
        int lastKey = reversedInput ? outputGradientSequence.firstKey() : outputGradientSequence.lastKey();
        int gradientStepCount = 0;
        for (Integer sampleIndex : inputKeySet) {
            setOutputSampleGradient(sampleIndex, outputGradientSequence.get(sampleIndex));
            gradientChain.calculateGradientStep(sampleIndex, lastKey);
            inputGradientSequence.put(sampleIndex, setInputSampleGradient(sampleIndex));
            if (numberOfGradientSteps > 0 && ++gradientStepCount >= numberOfGradientSteps) break;
        }
    }
public void calculateGradientPerSample ( Sequence outputGradientSequence , Sequence inputGradientSequence , int numberOfGradientSteps ) throws MatrixException , DynamicParamException { Set < Integer > inputKeySet = reversedInput ? outputGradientSequence . keySet ( ) : outputGradientSequence . descendingKeySet ( ) ; int lastKey = reversedInput ? outputGradientSequence . firstKey ( ) : outputGradientSequence . lastKey ( ) ; int gradientStepCount = 0 ; for ( Integer sampleIndex : inputKeySet ) { setOutputSampleGradient ( sampleIndex , outputGradientSequence . get ( sampleIndex ) ) ; gradientChain . calculateGradientStep ( sampleIndex , lastKey ) ; inputGradientSequence . put ( sampleIndex , setInputSampleGradient ( sampleIndex ) ) ; if ( numberOfGradientSteps > 0 && ++ gradientStepCount >= numberOfGradientSteps ) break ; } }
Calculates chain of backward expressions for multiple inputs per gradient expression step per sample.
Calculates chain of backward expressions for multiple inputs per gradient expression step per sample .