Beispiel #1
0
        public override Volume Forward(Volume input, bool isTraining = false)
        {
            this.InputActivation = input;
            var outputActivation = input.CloneAndZero();
            var length = input.Weights.Length;

#if PARALLEL
            Parallel.For(0, length, i =>
#else
            for (var i = 0; i < length; i++)
#endif
            { outputActivation.Weights[i] = Math.Tanh(input.Weights[i]); }
Beispiel #2
0
        public override Volume Forward(Volume input, bool isTraining = false)
        {
            this.InputActivation = input;
            var volume2 = input.CloneAndZero();
            var length  = input.Weights.Length;

            double[] v2w = volume2.Weights;
            double[] vw  = input.Weights;

            for (var i = 0; i < length; i++)
            {
                v2w[i] = 1.0 / (1.0 + Math.Exp(-vw[i]));
            }

            this.OutputActivation = volume2;
            return(this.OutputActivation);
        }