public void Test_Train_Correct() { var inputArray = new double[, , ] { { { 1, 3, 5, 8, 7, 4, 2, 8, 6 }, { 4, 2, 3, 5, 1, 0, 1, 2, 7 }, { 8, 3, 1, 2, 3, 6, 5, 8, 5 }, { 7, 2, 4, 2, 9, 3, 6, 4, 6 }, { 9, 8, 0, 8, 8, 3, 7, 1, 0 }, { 9, 4, 1, 2, 2, 4, 7, 4, 3 }, { 0, 5, 9, 1, 6, 4, 5, 4, 3 }, { 3, 0, 5, 8, 6, 5, 7, 0, 1 }, { 1, 4, 2, 3, 6, 1, 5, 4, 3 } }, { { 4, 3, 5, 0, 1, 2, 4, 8, 9 }, { 4, 8, 0, 1, 3, 4, 5, 6, 7 }, { 4, 4, 2, 3, 6, 5, 4, 2, 1 }, { 0, 7, 8, 6, 4, 4, 1, 0, 0 }, { 1, 0, 1, 2, 4, 5, 6, 2, 3 }, { 1, 2, 3, 7, 8, 8, 7, 4, 6 }, { 0, 3, 3, 2, 1, 7, 2, 3, 0 }, { 1, 8, 4, 4, 1, 2, 0, 0, 5 }, { 7, 9, 9, 9, 1, 3, 1, 4, 6 } }, { { 7, 1, 4, 3, 2, 1, 0, 4, 6 }, { 5, 3, 1, 9, 7, 5, 3, 1, 1 }, { 4, 2, 0, 8, 6, 4, 2, 0, 0 }, { 7, 8, 7, 4, 3, 8, 0, 1, 4 }, { 5, 2, 1, 3, 6, 5, 4, 7, 5 }, { 1, 6, 2, 4, 2, 3, 7, 6, 1 }, { 0, 3, 7, 1, 3, 0, 3, 1, 8 }, { 6, 4, 8, 8, 9, 0, 1, 2, 1 }, { 5, 6, 7, 8, 9, 0, 2, 4, 7 } } }; var filter1Array = new double[, , ] { { { 1, 4, 5 }, { 0, 3, 4 }, { 6, 8, 7 } }, { { 4, 1, 0 }, { 6, 3, 1 }, { 5, 4, 2 } }, { { 2, 2, 5 }, { 3, 7, 4 }, { 4, 1, 0 } } }; var filter2Array = new double[, , ] { { { 4, 7, 1 }, { 3, 0, 2 }, { 4, 2, 1 } }, { { 3, 2, 2 }, { 8, 3, 4 }, { 7, 7, 1 } }, { { 2, 3, 0 }, { 4, 0, 7 }, { 1, 5, 4 } } }; var expectedArray = new double[, , ] { { { 336, 320, 339, 402 }, { 360, 402, 448, 266 }, { 272, 377, 444, 353 }, { 408, 486, 299, 253 } }, { { 287, 312, 334, 336 }, { 330, 335, 379, 317 }, { 272, 300, 424, 352 }, { 410, 481, 250, 248 } } }; var errorArray = new double[, , ] { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 1, 2, 3, 4 }, { 5, 6, 7, 8 } }, { { 5, 4, 3, 2 }, { 1, 2, 3, 4 }, { 6, 5, 4, 3 }, { 4, 3, 2, 1 } } }; var input = Converters.Convert(inputArray); var filter1 = Converters.Convert(filter1Array); var filter2 = Converters.Convert(filter2Array); var expected = Converters.Convert(expectedArray); var error = Converters.Convert(errorArray); var layer = new ConvolutionalLayer { Stride = 2, ActivationFunction = new ActivationFunctionMoq() }; layer.Neurals.Add(new Filter { Weights = filter1 }); layer.Neurals.Add(new Filter { Weights = filter2 }); var newError = layer.Train(error, input, expected); }