Beispiel #1
0
        public override void Forward()
        {
            left.Forward();
            right.Forward();
            Y = ND.Add(left.Y, right.Y);

            if (left.Grad == null)
            {
                left.Grad = new NDarray <double>(left.Y.Shape);
            }
            if (right.Grad == null)
            {
                right.Grad = new NDarray <double>(right.Y.Shape);
            }
        }
Beispiel #2
0
 public override void Backward(NDarray <double> dY)
 {
     Grad = ND.Add(Grad, dY.T);
     function.Backward(Grad);
 }