Пример #1
0
        public void EluTest()
        {
            var a = new Matrix(2, 2);

            a.InRandomize();
            var b     = a.Duplicate();
            var Alpha = 0.01;

            a = new EluKernel(new Elu()).Forward(a);
            b.InMap((x) => x >= 0 ? x : Alpha * (Math.Exp(x) - 1));
            Assert.IsTrue(a == b, "ELU Activation successful");
        }
Пример #2
0
        public void EluPrimeTest()
        {
            var a = new Matrix(2, 2);

            a.InRandomize();
            var b     = a.Duplicate();
            var Alpha = 0.01;

            a = new EluKernel(new Elu()).Backward(a);
            b.InMap((x) => x >= 0 ? 1 : Alpha * Math.Exp(x));
            Assert.IsTrue(a == b, "ELU Derivative successful");
        }