コード例 #1
0
        public void MergeFrom(EncounterInteractStageResult other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Swish:
                if (Swish == null)
                {
                    Swish = new global::WUProtos.Data.Encounter.EncounterInteractSwishStageResult();
                }
                Swish.MergeFrom(other.Swish);
                break;

            case TypeOneofCase.Combat:
                if (Combat == null)
                {
                    Combat = new global::WUProtos.Data.Encounter.EncounterInteractCombatStageResult();
                }
                Combat.MergeFrom(other.Combat);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
コード例 #2
0
        public static IActivationFunction GetActivationFunction(ActivationFunction activationFunction)
        {
            IActivationFunction result;

            switch (activationFunction)
            {
            case ActivationFunction.ELU:
                result = new ELU();
                break;

            case ActivationFunction.ReLU:
                result = new ReLU();
                break;

            case ActivationFunction.Sigmoid:
                result = new Sigmoid();
                break;

            case ActivationFunction.None:
                result = null;
                break;

            case ActivationFunction.Swish:
                result = new Swish();
                break;

            default:
                result = new ReLU();
                break;
            }
            return(result);
        }
コード例 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Swish)
            {
                hash ^= Swish.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Combat)
            {
                hash ^= Combat.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Portkey)
            {
                hash ^= Portkey.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Picture)
            {
                hash ^= Picture.GetHashCode();
            }
            if (SpellGmtId.Length != 0)
            {
                hash ^= SpellGmtId.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #4
0
        public SwishItemDto(Swish swish)
        {
            if (swish == null)
            {
                return;
            }

            EnableEcomOnly = swish.EnableEcomOnly;
        }
コード例 #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Swish)
            {
                hash ^= Swish.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Combat)
            {
                hash ^= Combat.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Portkey)
            {
                hash ^= Portkey.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Picture)
            {
                hash ^= Picture.GetHashCode();
            }
            if (DisappearDelay != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(DisappearDelay);
            }
            if (IntroText.Length != 0)
            {
                hash ^= IntroText.GetHashCode();
            }
            hash ^= stageSetupSequence_.GetHashCode();
            hash ^= stageCompletionSequence_.GetHashCode();
            if (SpellAimLayout.Length != 0)
            {
                hash ^= SpellAimLayout.GetHashCode();
            }
            hash ^= idleLoopTimelines_.GetHashCode();
            if (RngIntroTimeline.Length != 0)
            {
                hash ^= RngIntroTimeline.GetHashCode();
            }
            if (RngLoopTimeline.Length != 0)
            {
                hash ^= RngLoopTimeline.GetHashCode();
            }
            if (SpellFailedTimeline.Length != 0)
            {
                hash ^= SpellFailedTimeline.GetHashCode();
            }
            hash ^= combatSpellList_.GetHashCode();
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #6
0
        public void SwishPrimeTest()
        {
            var a = new Matrix(2, 2);

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

            a = new Swish().Backward(a);
            b.InMap((x) => (1.0 + Math.Exp(x) + x) / Math.Pow(1.0 + Math.Exp(x), 2.0));
            Assert.IsTrue(Math.Abs(a.FrobeniusNorm() - b.FrobeniusNorm()) < 0.1, new Swish().Type().ToString() + "  Derivative.");
        }
コード例 #7
0
        public void SwishTest()
        {
            var a = new Matrix(2, 2);

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

            a = new Swish().Forward(a);
            b.InMap((x) => Math.Exp(-x) + 1.0);
            Assert.IsTrue(Math.Abs(a.FrobeniusNorm() - b.FrobeniusNorm()) < 0.1, new Swish().Type().ToString() + " Activation.");
        }
コード例 #8
0
        public void MergeFrom(EncounterStage other)
        {
            if (other == null)
            {
                return;
            }
            if (other.SpellGmtId.Length != 0)
            {
                SpellGmtId = other.SpellGmtId;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Swish:
                if (Swish == null)
                {
                    Swish = new global::WUProtos.Data.Encounter.EncounterStageSwish();
                }
                Swish.MergeFrom(other.Swish);
                break;

            case TypeOneofCase.Combat:
                if (Combat == null)
                {
                    Combat = new global::WUProtos.Data.Encounter.EncounterStageCombat();
                }
                Combat.MergeFrom(other.Combat);
                break;

            case TypeOneofCase.Portkey:
                if (Portkey == null)
                {
                    Portkey = new global::WUProtos.Data.Encounter.EncounterStagePortkey();
                }
                Portkey.MergeFrom(other.Portkey);
                break;

            case TypeOneofCase.Picture:
                if (Picture == null)
                {
                    Picture = new global::WUProtos.Data.Encounter.EncounterStagePicture();
                }
                Picture.MergeFrom(other.Picture);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
コード例 #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Swish)
            {
                hash ^= Swish.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Combat)
            {
                hash ^= Combat.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #10
0
 /// <summary>
 /// Insttanciates a <see cref="PaymentOrderPaymentOptionsItems"/> with the provided parameters.
 /// </summary>
 /// <param name="creditCard">Credit card options.</param>
 /// <param name="invoice">Invoice options.</param>
 /// <param name="swish">Swish options.</param>
 public PaymentOrderPaymentOptionsItems(CreditCardOptions creditCard, Invoice invoice, Swish swish)
 {
     CreditCard = creditCard;
     Invoice    = invoice;
     Swish      = swish;
 }
コード例 #11
0
        public void SwishRandomTest()
        {
            Python.Initialize();
            Chainer.Initialize();

            int ioCount    = Mother.Dice.Next(1, 50);
            int batchCount = Mother.Dice.Next(1, 5);

            Real[,] input = Initializer.GetRandomValues <Real[, ]>(batchCount, ioCount);

            Real[,] dummyGy = Initializer.GetRandomValues <Real[, ]>(batchCount, ioCount);

            Real beta = (Real)Mother.Dice.NextDouble();

            //Chainer
            NChainer.Swish <Real> cSwish = new NChainer.Swish <Real>(new[] { ioCount }, beta);

            Variable <Real> cX = new Variable <Real>(input);

            Variable <Real> cY = cSwish.Forward(cX);

            cY.Grad = dummyGy;

            cY.Backward();


            //KelpNet
            Swish <Real> swish = new Swish <Real>(new[] { ioCount }, beta);

            NdArray <Real> x = new NdArray <Real>(input, asBatch: true);

            NdArray <Real> y = swish.Forward(x)[0];

            y.Grad = dummyGy.Flatten();

            y.Backward();


            Real[] cYdata = ((Real[, ])cY.Data).Flatten();
            Real[] cXgrad = ((Real[, ])cX.Grad).Flatten();

            Real[] cbgrad = (Real[])cSwish.beta.Grad;

            //許容範囲を算出
            Real delta = 0.00001f;

            //y
            Assert.AreEqual(cYdata.Length, y.Data.Length);
            for (int i = 0; i < y.Data.Length; i++)
            {
                Assert.AreEqual(cYdata[i], y.Data[i], delta);
            }

            //x.grad
            Assert.AreEqual(cXgrad.Length, x.Grad.Length);
            for (int i = 0; i < x.Grad.Length; i++)
            {
                Assert.AreEqual(cXgrad[i], x.Grad[i], delta);
            }

            //b.grad
            Assert.AreEqual(cbgrad.Length, swish.Beta.Grad.Length);
            for (int i = 0; i < swish.Beta.Grad.Length; i++)
            {
                Assert.AreEqual(cbgrad[i], swish.Beta.Grad[i], delta);
            }
        }
コード例 #12
0
        public void MergeFrom(ClientEncounterStage other)
        {
            if (other == null)
            {
                return;
            }
            if (other.DisappearDelay != 0F)
            {
                DisappearDelay = other.DisappearDelay;
            }
            if (other.IntroText.Length != 0)
            {
                IntroText = other.IntroText;
            }
            stageSetupSequence_.Add(other.stageSetupSequence_);
            stageCompletionSequence_.Add(other.stageCompletionSequence_);
            if (other.SpellAimLayout.Length != 0)
            {
                SpellAimLayout = other.SpellAimLayout;
            }
            idleLoopTimelines_.Add(other.idleLoopTimelines_);
            if (other.RngIntroTimeline.Length != 0)
            {
                RngIntroTimeline = other.RngIntroTimeline;
            }
            if (other.RngLoopTimeline.Length != 0)
            {
                RngLoopTimeline = other.RngLoopTimeline;
            }
            if (other.SpellFailedTimeline.Length != 0)
            {
                SpellFailedTimeline = other.SpellFailedTimeline;
            }
            combatSpellList_.Add(other.combatSpellList_);
            switch (other.TypeCase)
            {
            case TypeOneofCase.Swish:
                if (Swish == null)
                {
                    Swish = new global::WUProtos.Data.Client.ClientEncounterStageSwish();
                }
                Swish.MergeFrom(other.Swish);
                break;

            case TypeOneofCase.Combat:
                if (Combat == null)
                {
                    Combat = new global::WUProtos.Data.Client.ClientEncounterStageCombat();
                }
                Combat.MergeFrom(other.Combat);
                break;

            case TypeOneofCase.Portkey:
                if (Portkey == null)
                {
                    Portkey = new global::WUProtos.Data.Client.ClientEncounterStagePortkey();
                }
                Portkey.MergeFrom(other.Portkey);
                break;

            case TypeOneofCase.Picture:
                if (Picture == null)
                {
                    Picture = new global::WUProtos.Data.Client.ClientEncounterStagePicture();
                }
                Picture.MergeFrom(other.Picture);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }