Esempio n. 1
0
        public void CanBack2()
        {
            wc_2.Run(vector_3);

            NetworkVector inputGradientCheck = new NetworkVector(
                new double[] { 11 * 1 + 12 * 2, 11 * 2 + 12 * 3, 11 * 3 + 12 * 4 }
                );
            NetworkVector biasesGradientCheck = new NetworkVector(
                new double[] { 11, 12 }
                );
            WeightsMatrix weightsGradientCheck = new WeightsMatrix(
                new double[, ] {
                { 11 * 111, 11 * 112, 11 * 113 }, { 12 * 111, 12 * 112, 12 * 113 }
            }
                );

            Assert.AreEqual(inputGradientCheck, wc_2.InputGradient(vector_2));
            Assert.AreEqual(biasesGradientCheck, wc_2.BiasesGradient(vector_2));
            Assert.AreEqual(weightsGradientCheck, wc_2.WeightsGradient(vector_2, vector_3));
        }
Esempio n. 2
0
        public void CanBack1()
        {
            wc_1b.Run(vector_1);

            NetworkVector inputGradientCheck   = vector_1.Copy();
            NetworkVector biasesGradientCheck  = vector_1.Copy();
            WeightsMatrix weightsGradientCheck = matrix_1.Copy();

            Assert.AreEqual(inputGradientCheck, wc_1b.InputGradient(vector_1));
            Assert.AreEqual(biasesGradientCheck, wc_1b.BiasesGradient(vector_1));
            Assert.AreEqual(weightsGradientCheck, wc_1b.WeightsGradient(vector_1, vector_1));
        }