/// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(QuaternionMulGrad(X2.Value, Y.Grad));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(QuaternionMulTransposeGrad(X1.Value, Y.Grad));
            }
        }
Example #2
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(AdjectShape(Y.Grad, X1.Shape));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(AdjectShape(Y.Grad, X2.Shape));
            }
        }
Example #3
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(Condition.Value * Y.Grad);
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad((1 - Condition.Value) * Y.Grad);
            }
        }
Example #4
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(AdjectShape(Y.Grad * Equal(X1.Value, Y.Value), X1.Shape));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(AdjectShape(Y.Grad * Sign(X1.Value - X2.Value) * NotEqual(X1.Value, Y.Value), X2.Shape));
            }
        }
Example #5
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(TrivectorCross(X2.Value, Y.Grad));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(TrivectorCross(Y.Grad, X1.Value));
            }
        }
Example #6
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(AdjectShape(Y.Grad * GreaterThanOrEqual(X1.Value, X2.Value), X1.Shape));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(AdjectShape(Y.Grad * GreaterThanOrEqual(X2.Value, X1.Value), X2.Shape));
            }
        }
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(ComplexMulGrad(Y.Grad, X2.Value));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(ComplexMulGrad(Y.Grad, X1.Value));
            }
        }
Example #8
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop)
            {
                X1.AddGrad(TrivectorQuaternionMulVGrad(Y.Grad, X2.Value));
            }

            if (X2.EnableBackprop)
            {
                X2.AddGrad(TrivectorQuaternionMulQGrad(X1.Value, Y.Grad, X2.Value));
            }
        }
Example #9
0
        /// <summary>逆伝搬</summary>
        public override void Backward()
        {
            if (Y.Grad == null)
            {
                return;
            }

            if (X1.EnableBackprop || X2.EnableBackprop)
            {
                VariableNode rnorm = Rcp(Square(X1.Value) + Square(X2.Value) + 1e-5f);

                if (X1.EnableBackprop)
                {
                    X1.AddGrad(Y.Grad * X2.Value * rnorm);
                }

                if (X2.EnableBackprop)
                {
                    X2.AddGrad(-Y.Grad * X1.Value * rnorm);
                }
            }
        }