src/main/java/convnet/Layer.java
/**
     * Initiate a convolutional layer.
     * @param prevLayer
     * @return
     */
Initiate a convolutional layer.
@param prevLayer
@return
Initiate a convolutional layer . @param prevLayer @return
public Layer initConvolutionalLayer(Layer prevLayer) {
        Layer layer = new Layer();
        layer.setLayerInput(prevLayer.getLayerOutput());
        layer.setLayerType("conv");
        int[] kernelShape = new int[]{5, 5, layer.getLayerInput().getDimensions()[2]};
        for (int i = 0; i < this.neuronsLength; i++) {
            Data newKernel = new Data();
            newKernel.write(NumPute.random3dMatrix(kernelShape));
            layer.setKernelByIndex(i, newKernel);
            double newBias = new Random().nextDouble();
            layer.setBiasByIndex(i, newBias);
        }
        return layer;
    }
public Layer initConvolutionalLayer ( Layer prevLayer ) { Layer layer = new Layer ( ) ; layer . setLayerInput ( prevLayer . getLayerOutput ( ) ) ; layer . setLayerType ( "conv" ) ; int [ ] kernelShape = new int [ ] { 5 , 5 , layer . getLayerInput ( ) . getDimensions ( ) [ 2 ] } ; for ( int i = 0 ; i < this . neuronsLength ; i ++ ) { Data newKernel = new Data ( ) ; newKernel . write ( NumPute . random3dMatrix ( kernelShape ) ) ; layer . setKernelByIndex ( i , newKernel ) ; double newBias = new Random ( ) . nextDouble ( ) ; layer . setBiasByIndex ( i , newBias ) ; } return layer ; }
Initiate a convolutional layer.
Initiate a convolutional layer .