static ActivationLayerTestData()
        {
            ForwardPass3DInput = new double[3][, , ]
            {
                ArrayConverter.Convert1Dto3D(new double[] { -0.1373, -0.6652, -0.3023, 0.3949, -0.7723, 0.8314, -0.522, -0.7727, 0.6695, -0.1751, 0.3415, -0.2609, 0.1327, -0.7253, 0.5736, -0.4703, -0.0114, 0.6249, -0.4426, -0.1919, 0.9343, 0.1582, 0.917, 0.8578, 0.0139, 0.6703, 0.9075, 0.6387, -0.5064, 0.2652, -0.7363, -0.489, 0.4913, 0.1366, 0.542, 0.054, 0.1426, -0.277, -0.639, -0.9406, -0.0756, 0.8314, 0.4752, 0.6286, -0.4181, -0.0374, 0.6331, -0.6089, -0.9931, -0.3484, -0.4937, -0.9013, -0.2657, -0.3771, -0.8656, 0.65, -0.4255, 0.2283, -0.1915, -0.6498, 0.2652, -0.3673, 0.9351, 0.7472, -0.0991, 0.708, -0.0508, -0.6944, 0.1182, -0.6649, 0.9512, 0.3307, -0.263, 0.3841, 0.8366 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { -0.6358, -0.1667, -0.8008, -0.1037, -0.2738, 0.3328, -0.0234, 0.7288, 0.171, -0.6736, -0.1629, 0.2376, 0.6312, -0.2268, 0.075, 0.0283, -0.5099, -0.8766, 0.0559, 0.3066, -0.5613, 0.6568, -0.5844, 0.3593, 0.5124, 0.1718, -0.5939, 0.1401, -0.0078, -0.2333, -0.2378, 0.0095, -0.0072, 0.6351, 0.0435, 0.5526, 0.6412, -0.7755, 0.8625, -0.4421, -0.5741, 0.3328, -0.0234, 0.1301, 0.0804, 0.467, -0.8684, 0.8925, -0.4946, -0.8469, 0.0048, 0.5943, -0.7643, -0.8756, 0.6359, -0.8456, -0.9299, -0.2702, -0.69, 0.8517, -0.2392, -0.8659, -0.5663, 0.2486, 0.3994, 0.2036, -0.5494, -0.1959, -0.3804, 0.8366, 0.4468, -0.1678, -0.7615, 0.8826, 0.3381 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { 0.9273, -0.1657, 0.3804, -0.2122, 0.0868, 0.0836, 0.5328, 0.5937, -0.3641, 0.6455, 0.5804, 0.4408, -0.2641, 0.2629, 0.1538, -0.1159, 0.1771, 0.7666, -0.5344, 0.5661, 0.7861, 0.9448, 0.8946, 0.7603, 0.0371, -0.9267, 0.9901, 0.7782, 0.0512, 0.6432, -0.9623, 0.3612, -0.2099, -0.1172, -0.7684, 0.2476, -0.2224, 0.421, -0.6561, 0.4326, -0.8467, 0.0836, 0.7496, 0.7794, -0.851, -0.4359, 0.4475, 0.7956, -0.1442, -0.3573, 0.7107, 0.0141, -0.5635, -0.8552, -0.2194, -0.2795, 0.3019, -0.9931, 0.4232, -0.6856, 0.1538, -0.4075, -0.3601, -0.295, 0.1983, -0.9956, -0.6783, -0.0062, 0.2155, 0.3526, 0.4413, 0.6376, -0.0891, 0.61, -0.9085 }, new int[] { 3, 5, 5 }),
            };

            ForwardPass3DOutput = new double[3][, , ]
            {
                ArrayConverter.Convert1Dto3D(new double[] { 0.4657, 0.3396, 0.425, 0.5975, 0.316, 0.6967, 0.3724, 0.3159, 0.6614, 0.4563, 0.5846, 0.4351, 0.5331, 0.3262, 0.6396, 0.3845, 0.4972, 0.6513, 0.3911, 0.4522, 0.7179, 0.5395, 0.7144, 0.7022, 0.5035, 0.6616, 0.7125, 0.6545, 0.376, 0.5659, 0.3238, 0.3801, 0.6204, 0.5341, 0.6323, 0.5135, 0.5356, 0.4312, 0.3455, 0.2808, 0.4811, 0.6967, 0.6166, 0.6522, 0.397, 0.4907, 0.6532, 0.3523, 0.2703, 0.4138, 0.379, 0.2888, 0.434, 0.4068, 0.2962, 0.657, 0.3952, 0.5568, 0.4523, 0.343, 0.5659, 0.4092, 0.7181, 0.6786, 0.4752, 0.67, 0.4873, 0.3331, 0.5295, 0.3396, 0.7214, 0.5819, 0.4346, 0.5949, 0.6977 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { 0.3462, 0.4584, 0.3099, 0.4741, 0.432, 0.5824, 0.4942, 0.6745, 0.5426, 0.3377, 0.4594, 0.5591, 0.6528, 0.4435, 0.5187, 0.5071, 0.3752, 0.2939, 0.514, 0.5761, 0.3632, 0.6585, 0.3579, 0.5889, 0.6254, 0.5428, 0.3557, 0.535, 0.4981, 0.4419, 0.4408, 0.5024, 0.4982, 0.6536, 0.5109, 0.6347, 0.655, 0.3153, 0.7032, 0.3912, 0.3603, 0.5824, 0.4942, 0.5325, 0.5201, 0.6147, 0.2956, 0.7094, 0.3788, 0.3001, 0.5012, 0.6444, 0.3177, 0.2941, 0.6538, 0.3004, 0.2829, 0.4329, 0.334, 0.7009, 0.4405, 0.2961, 0.3621, 0.5618, 0.5985, 0.5507, 0.366, 0.4512, 0.406, 0.6977, 0.6099, 0.4581, 0.3183, 0.7074, 0.5837 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { 0.7165, 0.4587, 0.594, 0.4471, 0.5217, 0.5209, 0.6301, 0.6442, 0.41, 0.656, 0.6412, 0.6084, 0.4344, 0.5653, 0.5384, 0.4711, 0.5442, 0.6828, 0.3695, 0.6379, 0.687, 0.7201, 0.7098, 0.6814, 0.5093, 0.2836, 0.7291, 0.6853, 0.5128, 0.6555, 0.2764, 0.5893, 0.4477, 0.4707, 0.3168, 0.5616, 0.4446, 0.6037, 0.3416, 0.6065, 0.3001, 0.5209, 0.6791, 0.6856, 0.2992, 0.3927, 0.61, 0.689, 0.464, 0.4116, 0.6706, 0.5035, 0.3627, 0.2983, 0.4454, 0.4306, 0.5749, 0.2703, 0.6042, 0.335, 0.5384, 0.3995, 0.4109, 0.4268, 0.5494, 0.2698, 0.3366, 0.4985, 0.5537, 0.5872, 0.6086, 0.6542, 0.4777, 0.6479, 0.2873 }, new int[] { 3, 5, 5 }),
            };

            BackwardPass3DInput = new double[3][, , ]
            {
                ArrayConverter.Convert1Dto3D(new double[] { -0.5571, -0.308, -0.2578, -0.1581, 0.662, 0.8304, -0.8366, -0.9919, -0.2656, -0.4944, 0.2664, 0.0191, 0.961, -0.7195, -0.8218, 0.2108, 0.4339, -0.2627, -0.395, -0.4333, 0.7081, 0.8854, -0.4701, -0.3428, -0.3556, 0.1381, 0.0353, -0.985, 0.3124, 0.2244, -0.3304, 0.2308, 0.9195, 0.4786, -0.4679, -0.8487, 0.4329, 0.9202, -0.9925, -0.7057, 0.1353, -0.3403, 0.6724, -0.8489, -0.5808, -0.821, 0.5459, -0.6486, 0.4494, -0.3159, -0.0436, -0.0271, 0.1558, 0.8314, -0.0832, 0.1883, -0.6557, -0.1043, 0.0382, -0.6987, 0.9576, 0.8377, 0.7134, 0.6284, -0.0022, -0.6583, -0.4368, 0.3299, 0.6825, 0.7599, 0.8805, 0.9658, 0.1755, -0.4973, 0.8666 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { -0.0527, -0.8066, -0.7622, 0.3404, -0.8395, -0.6652, 0.659, -0.4934, -0.7642, -0.9929, 0.7649, 0.5176, 0.4566, 0.782, 0.6796, -0.2936, 0.9324, -0.7671, -0.8935, -0.9319, 0.2037, -0.6161, 0.0343, 0.1557, 0.1429, 0.6425, 0.5339, -0.4806, 0.8109, 0.7229, 0.174, 0.7352, -0.5819, 0.9772, 0.0306, 0.6469, -0.0715, 0.4217, 0.5089, -0.2071, 0.6397, -0.8447, -0.829, 0.6526, -0.0823, -0.3224, 0.0415, -0.1501, 0.948, -0.8144, -0.548, 0.4715, -0.3486, 0.3328, -0.5817, -0.3103, -0.1513, 0.4001, 0.5426, 0.8028, -0.5439, -0.6638, 0.2148, -0.873, -0.5008, 0.8373, 0.0618, -0.1745, 0.184, -0.7416, -0.621, 0.4615, 0.674, -0.9958, -0.6349 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { -0.3413, -0.8956, 0.631, -0.5801, -0.2061, 0.3328, -0.0234, 0.7288, 0.171, -0.6736, 0.1812, -0.263, 0.3262, -0.7768, -0.1307, 0.6573, 0.0474, -0.5381, 0.7129, 0.7162, -0.8416, 0.323, -0.9474, 0.1146, -0.8749, -0.443, 0.3501, 0.1664, 0.0633, 0.1672, -0.9425, 0.6331, -0.1581, -0.2155, 0.1302, 0.1674, 0.5845, 0.7674, 0.8448, 0.8033, 0.7619, -0.3864, -0.6417, 0.0631, -0.2141, 0.847, -0.5259, -0.0056, -0.9937, -0.762, -0.9692, 0.2017, 0.8299, 0.0836, 0.0708, 0.9928, 0.7338, -0.1887, 0.2387, -0.7427, 0.8427, -0.8909, 0.004, 0.1629, 0.7382, -0.9239, -0.4884, 0.5324, 0.3547, 0.2375, 0.1648, 0.0391, 0.8387, -0.1473, -0.8383 }, new int[] { 3, 5, 5 }),
            };

            BackwardPass3DOutput = new double[3][, , ]
            {
                ArrayConverter.Convert1Dto3D(new double[] { -0.1386, -0.0691, -0.063, -0.038, 0.1431, 0.1755, -0.1955, -0.2144, -0.0595, -0.1227, 0.0647, 0.0047, 0.2392, -0.1581, -0.1894, 0.0499, 0.1085, -0.0597, -0.0941, -0.1073, 0.1434, 0.22, -0.0959, -0.0717, -0.0889, 0.0309, 0.0072, -0.2228, 0.0733, 0.0551, -0.0723, 0.0544, 0.2165, 0.1191, -0.1088, -0.212, 0.1077, 0.2257, -0.2244, -0.1425, 0.0338, -0.0719, 0.159, -0.1926, -0.139, -0.2052, 0.1237, -0.148, 0.0886, -0.0766, -0.0103, -0.0056, 0.0383, 0.2006, -0.0173, 0.0424, -0.1567, -0.0257, 0.0095, -0.1575, 0.2352, 0.2025, 0.1444, 0.1371, -0.0005, -0.1456, -0.1091, 0.0733, 0.17, 0.1704, 0.177, 0.235, 0.0431, -0.1198, 0.1828 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { -0.0119, -0.2003, -0.163, 0.0849, -0.206, -0.1618, 0.1647, -0.1083, -0.1897, -0.2221, 0.19, 0.1276, 0.1035, 0.193, 0.1697, -0.0734, 0.2186, -0.1592, -0.2232, -0.2276, 0.0471, -0.1385, 0.0079, 0.0377, 0.0335, 0.1594, 0.1224, -0.1196, 0.2027, 0.1783, 0.0429, 0.1838, -0.1455, 0.2212, 0.0076, 0.15, -0.0162, 0.091, 0.1062, -0.0493, 0.1474, -0.2054, -0.2072, 0.1625, -0.0205, -0.0764, 0.0086, -0.0309, 0.2231, -0.1711, -0.137, 0.1081, -0.0756, 0.0691, -0.1317, -0.0652, -0.0307, 0.0982, 0.1207, 0.1683, -0.134, -0.1384, 0.0496, -0.2149, -0.1203, 0.2072, 0.0143, -0.0432, 0.0444, -0.1564, -0.1478, 0.1146, 0.1463, -0.2061, -0.1543 }, new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(new double[] { -0.0693, -0.2224, 0.1522, -0.1434, -0.0514, 0.0831, -0.0055, 0.167, 0.0414, -0.152, 0.0417, -0.0627, 0.0801, -0.1909, -0.0325, 0.1638, 0.0118, -0.1165, 0.1661, 0.1654, -0.181, 0.0651, -0.1951, 0.0249, -0.2186, -0.09, 0.0691, 0.0359, 0.0158, 0.0378, -0.1885, 0.1532, -0.0391, -0.0537, 0.0282, 0.0412, 0.1443, 0.1836, 0.19, 0.1917, 0.16, -0.0964, -0.1398, 0.0136, -0.0449, 0.202, -0.1251, -0.0012, -0.2471, -0.1845, -0.2141, 0.0504, 0.1918, 0.0175, 0.0175, 0.2434, 0.1793, -0.0372, 0.0571, -0.1655, 0.2094, -0.2137, 0.001, 0.0399, 0.1827, -0.182, -0.1091, 0.1331, 0.0877, 0.0576, 0.0393, 0.0088, 0.2093, -0.0336, -0.1717 }, new int[] { 3, 5, 5 }),
            };

            ForwardPass1DInput = new double[3][]
            {
                new double[] { 0.6784, 0.8011, -0.6216, -0.3021, 0.9009, 0.4312, -0.7815, -0.8672, 0.1982, 0.0621 },
                new double[] { 0.466, -0.719, -0.123, 0.1964, 0.4023, 0.9297, 0.72, 0.6342, 0.6967, -0.4364 },
                new double[] { 0.5687, 0.6206, -0.8046, 0.3926, 0.6833, -0.5327, -0.9296, 0.2757, 0.0174, 0.9452 }
            };

            ForwardPass1DOutput = new double[3][]
            {
                new double[] { 0.6634, 0.6902, 0.3494, 0.425, 0.7111, 0.6062, 0.314, 0.2958, 0.5494, 0.5155 },
                new double[] { 0.6144, 0.3276, 0.4693, 0.5489, 0.5992, 0.717, 0.6726, 0.6534, 0.6675, 0.3926 },
                new double[] { 0.6385, 0.6504, 0.309, 0.5969, 0.6645, 0.3699, 0.283, 0.5685, 0.5043, 0.7201 }
            };

            BackwardPass1DInput = new double[3][]
            {
                new double[] { 0.2254, -0.1406, -0.6034, 0.5797, 0.7981, 0.6014, -0.8499, -0.8057, 0.8373, 0.497 },
                new double[] { 0.4798, -0.5903, -0.5014, -0.3729, -0.716, 0.1039, -0.6941, -0.3071, 0.3388, 0.9955 },
                new double[] { 0.4173, -0.4535, -0.3201, 0.1396, -0.375, 0.8534, 0.6252, 0.2191, -0.0895, 0.9187 }
            };

            BackwardPass1DOutput = new double[3][]
            {
                new double[] { 0.0503, -0.0301, -0.1372, 0.1417, 0.1639, 0.1436, -0.1831, -0.1678, 0.2073, 0.1241 },
                new double[] { 0.1137, -0.13, -0.1249, -0.0923, -0.1719, 0.0211, -0.1528, -0.0695, 0.0752, 0.2374 },
                new double[] { 0.0963, -0.1031, -0.0684, 0.0336, -0.0836, 0.1989, 0.1269, 0.0537, -0.0224, 0.1851 }
            };
        }
Example #2
0
 static TestValues()
 {
     Weights = new List <double[]>()
     {
         new double[] { 0.3, -0.6, 0.4, 0.6 },
         new double[] { 0.2, 0.1, -0.0, 0.2 },
         new double[] { -0.2, 0.8, 0.4, 0.5 }
     };
     Input = new double[] { 0.2, -0.5, -0.3, 0.1 };
     Error = new double[] { 0.1, -0.3, 0.8 };
     LR    = 0.1;
     MultiDimensionalInput = new double[2, 5, 5]
     {
         {
             { 54, 9, 61, 31, 29 },
             { 91, 81, 80, 59, 18 },
             { 3, 52, 27, 19, 71 },
             { 36, 3, 86, 30, 32 },
             { 2, 56, 53, 59, 91 }
         },
         {
             { 21, 19, 44, 22, 99 },
             { 65, 18, 52, 1, 49 },
             { 90, 27, 5, 12, 41 },
             { 75, 16, 97, 56, 95 },
             { 82, 89, 87, 15, 83 }
         }
     };
     Kernels = new double[2, 3, 3]
     {
         {
             { 2, 2, 2 },
             { 2, 2, 2 },
             { 2, 2, 2 }
         },
         {
             { 3, 3, 3 },
             { 3, 3, 3 },
             { 3, 3, 3 }
         }
     };
     ConvolutionBackwardPassKernels = ArrayConverter.Convert1Dto4D
                                      (
         new double[] { -1, 1, -1, 1, 0, 0, -1, 1, 0, 1, -1, 1, -1, 1, 0, 0, -1, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, -1, -1, 0, -1, -1, 1, 0, 0, 0, -1, -1, 0, -1, 1, 0, 0, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 0, -1, 0, 0, 1, -1, -1, 1, -1, -1, 0, 0, -1, 1, 0, -1, -1, -1, -1, 0, 0, -1, 1, 1, -1, -1, -1, -1, 0, 1, 1, 1, 0, -1, 0, 1, -1, 1, 1, 1, 0, -1, 1, -1, 0, 1, 1, 0, -1, 0, 1, 0, 1, -1, 1 },
         new int[] { 4, 3, 3, 3 }
                                      );
     ConvolutionBackwardPassDeltas = ArrayConverter.Convert1Dto3D
                                     (
         new double[] { -0.74, 0.55, 0.65, 0.54, 0.2, -0.97, -0.51, 0.68, 0.01, -0.27, -0.91, 0.91, 0.41, -0.06, 0.02, 0.54, 0.72, 0.18, 0.61, 0.78, 0.02, 0.13, -0.84, 0.66, 0.35, 0.13, 0.59, -0.69, -0.53, 0.73, 0.97, -0.26, -0.24, 0.13, 0.81, 0.59 },
         new int[] { 4, 3, 3 }
                                     );
     ConvolutionBackwardPassResult = ArrayConverter.Convert1Dto3D
                                     (
         new double[] { 0.4, -1.58, -0.6, -0.61, 0.08, -1.63, 3.17, 1.15, -3.78, 0.89, 2.2, -5.64, -1.04, 2.02, -0.57, -0.98, 0.35, 1.53, -1.76, -1.42, 0.86, -1.28, 1.46, -0.93, -1.18, -1.16, 1.25, -1.74, -1.59, 1.36, 2.72, 0.84, -2.92, 1.01, -1.16, -1.66, -0.52, -1.33, 0.92, -1.74, -0.78, -0.53, 0.82, 1.05, 0.05, -0.48, -0.24, -1.52, -1.14, -0.19, -0.96, -1.91, 3.45, 0.4, -1.66, 1.72, -0.67, -0.8, 1.41, -2.02, -0.56, 1.59, -2.04, -3.66, -0.36, 1.86, 1.2, 2.16, -0.03, -1.68, -1.27, -0.38, -2.05, -0.68, 0 },
         new int[] { 3, 5, 5 }
                                     );
 }
        static ConvolutionalLayerTestsData()
        {
            ForwardPassInput = new List <double[, , ]>
            {
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.3415, -0.2609, 0.1327, -0.7253, 0.5736, -0.4703, -0.0114, 0.6249, -0.4426, -0.1919, 0.9343, 0.1582, 0.917, 0.8578, 0.0139, 0.6703, 0.9075, 0.6387, -0.5064, 0.2652, -0.7363, -0.489, 0.4913, 0.1366, 0.542, 0.054, 0.1426, -0.277, -0.639, -0.9406, -0.0756, 0.8314, 0.4752, 0.6286, -0.4181, -0.0374, 0.6331, -0.6089, -0.9931, -0.3484, -0.4937, -0.9013, -0.2657, -0.3771, -0.8656, 0.65, -0.4255, 0.2283, -0.1915, -0.6498, 0.2652, -0.3673, 0.9351, 0.7472, -0.0991, 0.708, -0.0508, -0.6944, 0.1182, -0.6649, 0.9512, 0.3307, -0.263, 0.3841, 0.8366, 0.4427, 0.3973, -0.0943, 0.3965, 0.6751, 0.7815, 0.9526, 0.7285, 0.8998, -0.6332 },
                    new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { -0.1629, 0.2376, 0.6312, -0.2268, 0.075, 0.0283, -0.5099, -0.8766, 0.0559, 0.3066, -0.5613, 0.6568, -0.5844, 0.3593, 0.5124, 0.1718, -0.5939, 0.1401, -0.0078, -0.2333, -0.2378, 0.0095, -0.0072, 0.6351, 0.0435, 0.5526, 0.6412, -0.7755, 0.8625, -0.4421, -0.5741, 0.3328, -0.0234, 0.1301, 0.0804, 0.467, -0.8684, 0.8925, -0.4946, -0.8469, 0.0048, 0.5943, -0.7643, -0.8756, 0.6359, -0.8456, -0.9299, -0.2702, -0.69, 0.8517, -0.2392, -0.8659, -0.5663, 0.2486, 0.3994, 0.2036, -0.5494, -0.1959, -0.3804, 0.8366, 0.4468, -0.1678, -0.7615, 0.8826, 0.3381, 0.9471, 0.9017, -0.5928, -0.1021, 0.1766, -0.7199, -0.543, -0.773, -0.6017, 0.8682 },
                    new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.5804, 0.4408, -0.2641, 0.2629, 0.1538, -0.1159, 0.1771, 0.7666, -0.5344, 0.5661, 0.7861, 0.9448, 0.8946, 0.7603, 0.0371, -0.9267, 0.9901, 0.7782, 0.0512, 0.6432, -0.9623, 0.3612, -0.2099, -0.1172, -0.7684, 0.2476, -0.2224, 0.421, -0.6561, 0.4326, -0.8467, 0.0836, 0.7496, 0.7794, -0.851, -0.4359, 0.4475, 0.7956, -0.1442, -0.3573, 0.7107, 0.0141, -0.5635, -0.8552, -0.2194, -0.2795, 0.3019, -0.9931, 0.4232, -0.6856, 0.1538, -0.4075, -0.3601, -0.295, 0.1983, -0.9956, -0.6783, -0.0062, 0.2155, 0.3526, 0.4413, 0.6376, -0.0891, 0.61, -0.9085, -0.7316, 0.8129, 0.1922, -0.6162, 0.3492, -0.1289, 0.0491, 0.8907, -0.1935, -0.2572 },
                    new int[] { 3, 5, 5 })
            };

            ForwardPassOutput = new List <double[, , ]>
            {
                ArrayConverter.Convert1Dto3D(
                    new double[] { -2.5384, 0.0833, 1.4702, 1.6019, -0.7725, 1.7222, 1.6342, 0.5873, -1.376, -0.8473, 2.4959, -0.4295, -0.1451, 2.9142, 1.055, -1.7935, -1.3891, -1.5726, -1.8585, -1.4879, -0.9562, -3.2126, -4.4176, -2.19, -0.0164, 0.8857, -0.0115, -1.8561, -2.1724, 1.2525, 1.0665, -2.2269, 2.0124, 3.0936, 1.7369, -1.1955 },
                    new int[] { 4, 3, 3 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { -1.7482, -0.3396, -1.9895, -0.2696, 1.4921, 0.824, 2.8416, 4.8009, -1.4374, 0.7157, -0.5085, 0.375, -1.1667, -0.0121, -1.1641, -1.1259, -2.645, -0.4596, -4.1671, 2.1836, 1.6042, -0.7752, -2.619, 3.3521, -0.8754, 2.7884, 0.1851, 2.8769, -3.0083, 0.4701, -0.2509, 0.7464, -1.2439, -0.8227, -1.0186, 1.9384 },
                    new int[] { 4, 3, 3 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { 2.2747, -0.5732, -0.5085, -1.0602, -1.2972, -2.3578, -0.5115, -1.9571, 1.5389, 0.3379, -0.6299, 0.4982, -3.1798, 0.6145, 2.2803, 1.2345, 2.7123, 4.0491, 1.0319, 1.2897, -2.9985, 0.3483, -1.2361, 0.3816, -1.3402, 0.2369, -1.4356, 0.4517, 1.3081, -0.2519, 0.2525, -2.1664, -0.8067, -3.9882, -0.5452, -0.1667 },
                    new int[] { 4, 3, 3 }),
            };

            BackwardPassInput = new List <double[, , ]>
            {
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.1828, 0.7861, -0.4005, -0.1407, -0.9267, -0.6629, 0.0348, -0.9623, -0.7228, -0.4555, -0.2795, -0.0892, 0.1768, 0.1538, 0.1777, -0.0257, -0.9956, -0.9867, 0.7454, -0.3413, 0.8386, 0.0968, 0.8436, -0.2885, 0.1029, 0.1812, 0.1121, -0.607, 0.1674, -0.7387, -0.5612, 0.7619, -0.3432, 0.076, 0.847, 0.7298 },
                    new int[] { 4, 3, 3 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.4235, -0.0552, 0.5677, -0.7545, -0.7163, -0.7308, 0.5715, -0.6806, -0.7955, 0.4981, -0.8649, 0.6955, -0.5082, -0.1113, -0.7583, -0.0564, -0.6474, 0.6554, -0.7561, 0.3838, 0.7053, 0.5954, -0.6578, 0.3311, -0.3957, 0.6798, -0.3865, 0.8945, 0.6659, 0.7628, 0.9403, -0.7395, 0.1554, 0.5745, 0.3485, -0.7717 },
                    new int[] { 4, 3, 3 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.0149, 0.233, -0.4606, 0.4675, 0.3661, 0.2834, -0.7929, 0.6703, 0.3747, -0.0454, 0.3938, 0.4866, -0.4287, 0.0405, 0.7272, -0.8445, 0.1266, 0.3151, -0.3466, -0.0922, 0.8604, 0.1226, -0.6157, 0.8287, 0.7568, -0.4244, 0.042, 0.7974, 0.445, -0.3072, 0.0048, 0.0147, 0.9689, 0.1701, -0.6448, 0.6716 },
                    new int[] { 4, 3, 3 }),
            };

            BackwardPassOutput = new List <double[, , ]>
            {
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.9062, 0.0736, 0.7874, 1.3406, 0.3624, -0.8841, 0.8644, -1.1513, -0.0689, -0.8405, -1.1885, 0.5971, 1.1832, 0.2252, 2.2433, 0.4917, 0.8928, 0.5849, -0.6429, -0.2216, -0.1686, -0.774, -2.0838, 0.238, 1.2, -0.7933, -0.2347, -0.1964, -0.8931, 0.3919, -0.6846, -0.4304, 0.4418, -0.515, 0.1666, 1.2895, -0.6479, 1.1862, 1.5593, -1.0968, 0.3371, -1.218, -0.8096, 1.3254, -0.459, 0.0122, -1.5171, -1.1615, 1.5532, 1.5095, -0.2072, -1.0565, 0.8737, -1.0761, 0.1747, -0.2044, 0.5626, 1.1425, -2.6535, 1.9202, 0.1546, -1.1839, -0.9819, -0.1033, 1.1094, -0.3205, -2.0242, -1.0679, -3.2011, -1.0958, -0.0232, 0.6729, 0.1993, -2.1148, -1.5748 },
                    new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { -0.3386, -0.0305, -0.8274, 0.6167, 0.7005, 0.7988, 1.1371, -1.0427, 0.4206, 0.1915, -2.5214, 0.542, -2.9646, -2.9461, 0.3503, 1.2355, 0.2144, 0.853, -0.472, -0.9784, -0.8513, 0.5303, 0.1504, 0.5017, -0.4084, 0.7711, 0.0429, -0.2839, -1.2153, -0.1322, -1.9629, 1.1422, 0.1965, 1.2481, -0.5842, -0.476, -0.0506, 0.781, 1.4496, 2.2962, -0.676, 0.6846, 0.9568, -0.3536, 0.7122, -0.8498, -0.112, 0.8907, 1.0352, 0.5873, 0.4035, -0.4495, 0.1756, 0.7153, 1.273, 0.3221, -0.3809, 0.9221, -2.903, 0.9018, 0.9584, -2.9301, -1.6946, 0.3748, -3.3184, -0.147, 0.828, -0.1359, 1.7769, 1.4562, 0.4207, -1.2591, 0.4516, 1.6692, 0.0297 },
                    new int[] { 3, 5, 5 }),
                ArrayConverter.Convert1Dto3D(
                    new double[] { 0.0747, -0.1692, 1.4409, 0.1859, -0.46, -0.3005, 0.1513, -0.6389, -0.0502, 0.7944, -0.1618, -1.2533, -0.5063, -0.3221, -0.0274, -0.5964, 2.7421, -1.9538, 0.1715, 0.6959, -0.8801, -0.4828, 0.8917, -0.2003, 0.5537, 0.7843, -0.4454, -0.6058, 1.2188, -0.2741, -0.7833, -0.376, -0.3817, -0.1822, -2.0805, -0.6347, -0.1817, 1.0638, -1.4486, -0.3036, -0.0868, 0.2546, 0.1922, -0.3036, 0.8964, 1.5329, -1.3328, 0.6942, -0.1771, 0.1852, -0.0989, -0.5889, -0.7576, 0.3503, 0.2235, 0.7928, 0.1711, 0.4749, -0.462, -0.9733, -1.6361, 0.7799, 2.4697, -0.3761, -0.1279, -0.5258, -1.5863, 1.1598, 0.4772, -1.2055, -0.3842, -0.622, 0.6298, 0.24, -0.9342 },
                    new int[] { 3, 5, 5 }),
            };

            Weights = new double[3][][, , ]
            {
                new double[4][, , ]
                {
                    ArrayConverter.Convert1Dto3D(new double[] { -0.1629, -0.9503, 0.5175, 0.0283, 0.5582, -0.6672, -0.5613, 0.5167, -0.6943, 0.1718, -0.0591, 0.5904, -0.2378, 0.3119, -0.4655, 0.5526, -0.6986, -0.1458, -0.5741, 0.7244, -0.7515, 0.467, 0.7636, -0.0079, 0.0048, 0.537, 0.6125 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { -0.8305, 0.1768, -0.9438, -0.6817, 0.8343, 0.1781, 0.6528, 0.7406, -0.371, 0.2024, -0.4601, 0.8106, 0.5506, -0.5852, 0.5811, 0.438, 0.419, -0.9318, 0.3794, 0.3052, -0.6674, 0.1243, 0.2029, 0.493, -0.5743, 0.4495, 0.7176 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.7104, 0.2376, 0.9615, -0.8636, -0.5099, -0.906, -0.7878, 0.6568, 0.2833, -0.6784, -0.5939, 0.637, -0.8011, 0.0095, 0.5839, 0.6216, 0.6412, 0.3958, 0.3021, -0.268, -0.7322, -0.9009, -0.8684, 0.6936, -0.4312, 0.5943, 0.1327 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { -0.0464, -0.4892, 0.4344, 0.8682, 0.2967, -0.8193, -0.6735, -0.2312, 0.4115, 0.3737, 0.5986, -0.2254, -0.7752, -0.5243, 0.1406, -0.7858, -0.3576, 0.6034, 0.2547, 0.3827, -0.5797, -0.666, 0.1914, -0.7981, 0.0824, 0.6022, -0.6014 }, new int[] { 3, 3, 3 }),
                },
                new double[4][, , ]
                {
                    ArrayConverter.Convert1Dto3D(new double[] { -0.6614, 0.5453, -0.0358, 0.5268, 0.0596, 0.8285, -0.0628, -0.9848, 0.8072, -0.3268, -0.5577, -0.911, 0.2607, -0.1867, -0.964, -0.9489, -0.2, -0.6443, 0.9273, 0.2259, 0.7499, 0.9656, -0.7379, 0.4906, 0.5034, -0.9645, -0.889 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.8731, 0.5542, 0.6124, -0.2134, 0.7097, -0.0109, -0.8487, -0.5734, 0.0396, 0.7009, 0.0443, 0.858, -0.9508, -0.0866, 0.0826, 0.9365, 0.9175, 0.5696, -0.1192, -0.1933, -0.1689, -0.3742, 0.7014, 0.9915, -0.0758, -0.049, -0.7839 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.0205, -0.0705, 0.7071, -0.5301, 0.9916, 0.45, 0.9549, -0.6142, 0.6969, -0.466, -0.5505, 0.2186, 0.719, 0.2229, -0.7906, 0.123, -0.2841, -0.2287, -0.1964, 0.2306, 0.9646, -0.4023, -0.3698, -0.8079, -0.9297, 0.0957, 0.6312 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { -0.5342, 0.5318, -0.2672, 0.8004, 0.5589, -0.4497, -0.8449, -0.2248, -0.6183, 0.2326, 0.5063, -0.4798, -0.9924, 0.193, 0.5903, -0.3586, -0.0984, 0.5014, -0.0876, -0.2155, 0.3729, 0.7085, -0.772, 0.716, -0.4162, 0.6925, -0.1039 }, new int[] { 3, 3, 3 }),
                },
                new double[4][, , ]
                {
                    ArrayConverter.Convert1Dto3D(new double[] { -0.0988, 0.9498, -0.4857, 0.283, -0.7954, -0.0751, -0.0552, 0.7061, 0.4481, -0.7163, -0.8635, -0.4813, -0.6806, -0.8999, 0.8937, -0.579, 0.2421, 0.1235, 0.8892, 0.6734, 0.5297, -0.5839, 0.8962, 0.9586, 0.1448, -0.3559, -0.8265 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.6106, -0.1007, 0.7507, -0.221, -0.6656, 0.3158, 0.3191, 0.472, -0.1381, 0.7467, 0.5668, -0.3794, 0.1413, -0.6775, -0.8014, -0.4374, 0.131, -0.3025, 0.2371, 0.8632, -0.0379, 0.3498, -0.4562, -0.1278, 0.8834, 0.4968, -0.0611 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.348, -0.2736, -0.8862, -0.3518, 0.6785, -0.2734, -0.7355, -0.2139, 0.738, -0.5687, 0.8031, -0.5107, -0.6206, -0.568, 0.1165, 0.8046, 0.1403, 0.4579, -0.3926, -0.0726, 0.5149, -0.6833, -0.2151, -0.8931, 0.5327, -0.2208, -0.7641 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.2815, -0.7441, 0.9327, -0.2166, 0.2817, -0.8588, -0.5747, -0.2856, 0.5931, 0.7923, -0.8284, -0.4173, -0.3272, 0.0295, 0.4535, 0.5613, 0.0614, 0.3201, -0.2978, -0.9897, -0.1396, 0.3964, -0.8556, 0.375, 0.4318, -0.1291, -0.8534 }, new int[] { 3, 3, 3 }),
                }
            };

            WeightGradients = new double[3][][, , ]
            {
                new double[4][, , ] {
                    ArrayConverter.Convert1Dto3D(new double[] { -1.3159, -1.4339, -1.1298, -2.5428, -0.9913, -0.7722, -1.341, -0.5662, 0.5339, -1.0123, 0.416, 0.6378, 1.3138, 1.9042, 2.9647, 2.0826, 0.5617, 0.8701, -0.302, 0.9279, 0.2435, -0.1971, -0.8419, -1.514, -1.2448, -1.8497, -1.2657 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { -1.1546, -1.6015, -0.7919, -1.0368, 0.0319, 0.3788, -0.159, -0.8475, -1.2599, 0.1306, 1.9711, 1.8432, 0.9144, -0.066, 0.5592, -0.1971, -0.3242, 1.1532, -0.2018, -0.3811, -2.0498, -0.3879, -0.0146, -0.5546, -2.0669, -1.6228, -0.1877 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.4471, 0.0843, 0.8213, 0.4417, 0.1008, 1.268, 1.9483, 1.3511, 0.0966, 0.3589, -0.1915, -0.3619, 0.5206, 0.6356, -1.1999, -1.4707, -0.3796, -0.5853, 1.4615, -0.5617, 0.7195, 0.5167, 0.0658, -0.9205, 1.1155, 0.8338, 0.6721 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.566, 2.7655, -0.4413, 0.3892, 0.9943, -0.3643, -1.2336, 0.0536, -0.71, 0.7975, -1.1735, -0.03, -0.4485, -1.9366, -1.141, 0.1156, 0.7015, 0.0005, -0.9505, -0.6309, 1.2545, 0.1844, -0.4508, 1.9069, 1.1568, 0.3867, 0.0847 }, new int[] { 3, 3, 3 }),
                },

                new double[4][, , ] {
                    ArrayConverter.Convert1Dto3D(new double[] { 0.9578, 1.3961, -0.2664, 0.3135, -0.9039, -0.1202, -0.549, 0.3729, -0.377, 0.1182, -0.2357, 0.7591, -0.4511, 2.1498, -0.0184, 1.2462, 0.2425, 0.3013, 0.9834, 0.3588, -1.5228, 0.7441, 0.5893, -0.3015, -0.588, 0.9854, -0.5108 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.0829, 0.3058, 0.9057, 0.9674, -0.0604, -0.559, -1.379, 1.795, -0.5211, 0.5746, 0.4718, -1.7885, -2.2935, 0.881, 1.2022, 2.588, -1.3263, 1.3071, -0.0735, 1.9018, -1.0187, -0.2163, -0.602, 1.0609, -0.4086, 1.0108, 0.2733 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 1.616, -0.6019, -0.6911, -2.321, 1.3162, 0.5153, 0.907, -1.17, 1.3702, -2.4073, 1.224, 0.1706, 2.3876, -1.8531, 0.1621, -0.8912, 1.668, -1.8218, -0.1297, -0.5039, 1.9865, 0.0886, 0.0448, -0.2329, -0.9503, 1.2721, 0.4869 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 1.1189, 0.5337, -0.9531, -2.3036, -0.178, -0.9908, -0.0157, -0.678, 0.3922, -1.1829, 1.2593, 0.4316, 1.7099, -0.4213, -0.0346, -0.6348, 0.3323, -1.2023, 0.1306, -2.4357, -0.2, 1.4085, 0.0207, -1.619, -0.1676, 1.1694, -1.6138 }, new int[] { 3, 3, 3 }),
                },

                new double[4][, , ] {
                    ArrayConverter.Convert1Dto3D(new double[] { 0.8061, 0.1713, 0.1239, 2.3434, 1.1678, -0.0085, 0.8961, 0.1636, 0.5382, 0.5489, 1.0558, -0.8126, -0.9181, -0.4328, 0.594, -0.0391, -0.9301, 0.3183, -0.5982, -0.5491, 0.1496, 1.4414, -0.4191, -0.6227, 0.6751, 0.4691, -0.4098 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.3707, -0.8746, -0.3958, 1.953, -0.5036, -0.7436, 2.5672, -0.0449, 0.3333, 1.693, 0.0953, -1.7783, 0.4437, 0.0534, -0.4495, -0.1694, -0.6753, 0.4568, -0.2679, -0.1771, 0.1307, 0.3282, -0.5565, -0.4713, 1.0698, -0.5457, -0.909 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 0.2745, -0.4281, 1.4477, -0.1494, 0.0244, 0.5372, -0.5586, 0.2864, 0.1073, 0.2764, -0.3367, -0.1581, 1.7693, 0.2319, -1.2464, 0.0245, -0.0448, -1.2542, 0.0245, 0.5658, 0.1169, -0.9006, 1.5674, -0.4321, -0.8003, -0.5662, 0.6307 }, new int[] { 3, 3, 3 }),
                    ArrayConverter.Convert1Dto3D(new double[] { 1.6102, -0.258, 0.0903, 0.3619, 1.1019, 0.7823, 0.999, 1.1018, 1.1918, 0.8642, 0.4444, -0.9103, -0.3595, -0.1737, 1.1697, -1.8444, 0.8943, -0.4501, -0.3647, 0.3865, -1.1532, -1.6882, -0.4166, -0.2245, 1.4023, -1.0049, 0.9132 }, new int[] { 3, 3, 3 }),
                }
            };
        }
Example #4
0
        public void Convert1Dto3DTest()
        {
            var actual = ArrayConverter.Convert1Dto3D(Convert1Dto3DTestInput, new int[] { 3, 3, 3 });

            CollectionAssert.AreEqual(Convert1Dto3DTestOutput, actual);
        }