@Test public void testMaxPoolingWithPaddingActivation() { final Matrix poolingActivation = maxPoolingWithPaddingLayer.feedForward(input); assertTrue(expectedMaxPoolingWithPaddingActivation.compare(poolingActivation, TOLERANCE)); }
@Override public Matrix feedForward(final Matrix input) { switch (poolingType) { case MAX: return feedForwardMaxPooling(input); case AVERAGE: return feedForwardAveragePooling(input); default: throw new IllegalArgumentException("Illegal pooling type: " + poolingType); } }
PoolingLayer extends LayerBase { @Override public Matrix feedForward(final Matrix input) { switch (poolingType) { case MAX: return feedForwardMaxPooling(input); case AVERAGE: return feedForwardAveragePooling(input); default: throw new IllegalArgumentException("Illegal pooling type: " + poolingType); } } }
PoolingLayer extends LayerBase { @Override public Matrix feedForward(final Matrix input) { switch (poolingType) { case MAX: return feedForwardMaxPooling(input); case AVERAGE: return feedForwardAveragePooling(input); default: throw new IllegalArgumentException("Illegal pooling type: " + poolingType); } } @Inject private  PoolingLayer(@Parameter(LayerIndex.class) final int index,
                       @Parameter(LayerInputShape.class) final String inputShape,
                       @Parameter(PoolingType.class) final String poolingType,
                       @Parameter(PaddingHeight.class) final int paddingHeight,
                       @Parameter(PaddingWidth.class) final int paddingWidth,
                       @Parameter(StrideHeight.class) final int strideHeight,
                       @Parameter(StrideWidth.class) final int strideWidth,
                       @Parameter(KernelHeight.class) final int kernelHeight,
                       @Parameter(KernelWidth.class) final int kernelWidth,
                       final LayerParameterInitializer layerParameterInitializer,
                       final MatrixFactory matrixFactory); }
PoolingLayer extends LayerBase { @Override public Matrix feedForward(final Matrix input) { switch (poolingType) { case MAX: return feedForwardMaxPooling(input); case AVERAGE: return feedForwardAveragePooling(input); default: throw new IllegalArgumentException("Illegal pooling type: " + poolingType); } } @Inject private  PoolingLayer(@Parameter(LayerIndex.class) final int index,
                       @Parameter(LayerInputShape.class) final String inputShape,
                       @Parameter(PoolingType.class) final String poolingType,
                       @Parameter(PaddingHeight.class) final int paddingHeight,
                       @Parameter(PaddingWidth.class) final int paddingWidth,
                       @Parameter(StrideHeight.class) final int strideHeight,
                       @Parameter(StrideWidth.class) final int strideWidth,
                       @Parameter(KernelHeight.class) final int kernelHeight,
                       @Parameter(KernelWidth.class) final int kernelWidth,
                       final LayerParameterInitializer layerParameterInitializer,
                       final MatrixFactory matrixFactory); @Override int[] getOutputShape(); @Override boolean isLearnable(); @Override Matrix feedForward(final Matrix input); @Override Matrix backPropagate(final Matrix input, final Matrix activation, final Matrix nextError); @Override LayerParameter generateParameterGradient(final Matrix input, final Matrix error); }
PoolingLayer extends LayerBase { @Override public Matrix feedForward(final Matrix input) { switch (poolingType) { case MAX: return feedForwardMaxPooling(input); case AVERAGE: return feedForwardAveragePooling(input); default: throw new IllegalArgumentException("Illegal pooling type: " + poolingType); } } @Inject private  PoolingLayer(@Parameter(LayerIndex.class) final int index,
                       @Parameter(LayerInputShape.class) final String inputShape,
                       @Parameter(PoolingType.class) final String poolingType,
                       @Parameter(PaddingHeight.class) final int paddingHeight,
                       @Parameter(PaddingWidth.class) final int paddingWidth,
                       @Parameter(StrideHeight.class) final int strideHeight,
                       @Parameter(StrideWidth.class) final int strideWidth,
                       @Parameter(KernelHeight.class) final int kernelHeight,
                       @Parameter(KernelWidth.class) final int kernelWidth,
                       final LayerParameterInitializer layerParameterInitializer,
                       final MatrixFactory matrixFactory); @Override int[] getOutputShape(); @Override boolean isLearnable(); @Override Matrix feedForward(final Matrix input); @Override Matrix backPropagate(final Matrix input, final Matrix activation, final Matrix nextError); @Override LayerParameter generateParameterGradient(final Matrix input, final Matrix error);  }