src/main/java/convnet/CNN.java
/**
     * Logic for the fully connected activation layer.
     * @param layer
     * @return
     */
Logic for the fully connected activation layer.
@param layer
@return
Logic for the fully connected activation layer . @param layer @return
private double[] activate(Layer layer) {
        double[] output = new double[this.classes.length];
        execConvolutionalLayer(layer);
        Data convOutput = layer.getLayerOutput();
        int convOutputLength = convOutput.getDimensions()[2];
        if (this.classes.length != convOutputLength) {
            String message = String.format("Activation Error: Expected %d classes, evaluated %d output classes",
                    this.classes.length,
                    convOutputLength
            );
            throw new RuntimeException(message);
        }
        for (int i = 0; i < convOutput.getDimensions()[2]; i++) {
            output[i] = convOutput.read3d()[0][0][i];
        }
        output = NumPute.softmax(output);
        return output;
    }
private double [ ] activate ( Layer layer ) { double [ ] output = new double [ this . classes . length ] ; execConvolutionalLayer ( layer ) ; Data convOutput = layer . getLayerOutput ( ) ; int convOutputLength = convOutput . getDimensions ( ) [ 2 ] ; if ( this . classes . length != convOutputLength ) { String message = String . format ( "Activation Error: Expected %d classes, evaluated %d output classes" , this . classes . length , convOutputLength ) ; throw new RuntimeException ( message ) ; } for ( int i = 0 ; i < convOutput . getDimensions ( ) [ 2 ] ; i ++ ) { output [ i ] = convOutput . read3d ( ) [ 0 ] [ 0 ] [ i ] ; } output = NumPute . softmax ( output ) ; return output ; }
Logic for the fully connected activation layer.
Logic for the fully connected activation layer .