### Question:
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);  }### Answer:
@Test public void testMaxPoolingActivation() { final Matrix poolingActivation = maxPoolingLayer.feedForward(input); assertTrue(expectedMaxPoolingActivation.compare(poolingActivation, TOLERANCE)); }
@Test public void testAveragePoolingActivation() { final Matrix poolingActivation = averagePoolingLayer.feedForward(input); assertTrue(expectedAveragePoolingActivation.compare(poolingActivation, TOLERANCE)); }
@Test public void testRemainderExistingMaxPoolingActivation() { final Matrix poolingActivation = remainderExistingMaxPoolingLayer.feedForward(input); assertTrue(expectedRemainderExistingMaxPoolingActivation.compare(poolingActivation, TOLERANCE)); }
@Test public void testRemainderExistingAveragePoolingActivation() { final Matrix poolingActivation = remainderExistingAveragePoolingLayer.feedForward(input); assertTrue(expectedRemainderExistingAveragePoolingActivation.compare(poolingActivation, TOLERANCE)); }
@Test public void testMaxPoolingWithPaddingActivation() { final Matrix poolingActivation = maxPoolingWithPaddingLayer.feedForward(input); assertTrue(expectedMaxPoolingWithPaddingActivation.compare(poolingActivation, TOLERANCE)); }
@Test public void testAveragePoolingWithPaddingActivation() { final Matrix poolingActivation = averagePoolingWithPaddingLayer.feedForward(input); assertTrue(expectedAveragePoolingWithPaddingActivation.compare(poolingActivation, TOLERANCE)); }
@Test public void test3DActivation() { final Matrix poolingMaxActivation = maxPooling3DLayer.feedForward(input3D); final Matrix poolingAverageActivation = averagePooling3DLayer.feedForward(input3D); assertTrue(expectedMaxPooling3DActivation.compare(poolingMaxActivation, TOLERANCE)); assertTrue(expectedAveragePooling3DActivation.compare(poolingAverageActivation, TOLERANCE)); }