nn.setLayerCalculator(NNFactory.lcWeightedSum(nn, null));
Conv2DConnection cc = (Conv2DConnection) nn.getInputLayer().getConnections().get(0);
cc.getWeights().forEach(i -> cc.getWeights().getElements()[i] = 1);
ValuesProvider vp = TensorFactory.tensorProvider(nn, 1, true);
float[] src = new float[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
System.arraycopy(src, 0, vp.get(nn.getInputLayer()).getElements(), vp.get(nn.getInputLayer()).getStartIndex(), src.length);
Set<Layer> calculatedLayers = new HashSet<>();
calculatedLayers.add(nn.getInputLayer());
nn.getLayerCalculator().calculate(nn, nn.getOutputLayer(), calculatedLayers, vp);
Tensor o = vp.get(nn.getOutputLayer());
assertEquals(16, o.get(0, 0, 0, 0), 0.00001);
assertEquals(24, o.get(0, 0, 1, 0), 0.00001);
assertEquals(56, o.get(0, 1, 0, 0), 0.00001);
assertEquals(64, o.get(0, 1, 1, 0), 0.00001);
}