public override IVolume Forward(IVolume input, bool isTraining = false)
        {
            this.InputActivation = input;
            var outputActivation = input.CloneAndZero();
            var length = input.Length;

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

            for (var i = 0; i < length; i++)
            {
                volume2.Set(i, 1.0 / (1.0 + Math.Exp(-input.Get(i))));
            }

            this.OutputActivation = volume2;
            return(this.OutputActivation);
        }
Ejemplo n.º 3
0
            public override IVolume Forward(IVolume input, bool isTraining = false)
            {
                this.InputActivation = input;
                var outputActivation = input.CloneAndZero();
                var length           = input.Length;


                Parallel.For(0, length, i =>
                {
                    outputActivation.SetWeight(i, Math.Tanh(input.GetWeight(i)));
                });
                this.OutputActivation = outputActivation;
                return(this.OutputActivation);
            }