コード例 #1
0
        void InitFunc(StreamingContext sc)
        {
            this.Predict = x => x; //Predict時は何もしない

            switch (this)
            {
            case Dropout <float> dropOutF:
                dropOutF.SingleInputForward   = x => DropOutF.SingleInputForward(x, dropOutF.DropoutRatio, dropOutF.maskStack, dropOutF);
                dropOutF.SingleOutputBackward = (y, x) => DropOutF.SingleOutputBackward(y, x, dropOutF.maskStack);
                break;

            case Dropout <double> dropOutD:
                dropOutD.SingleInputForward   = x => DropOutD.SingleInputForward(x, dropOutD.DropoutRatio, dropOutD.maskStack, dropOutD);
                dropOutD.SingleOutputBackward = (y, x) => DropOutD.SingleOutputBackward(y, x, dropOutD.maskStack);
                break;
            }
        }
コード例 #2
0
        void InitFunc(StreamingContext sc)
        {
            if (IsParallel)
            {
                switch (this)
                {
                case Dropout <float> dropOutF:
                    dropOutF.SingleInputForward   = x => DropOutF.SingleInputForward(x, CPU.DropOutF.MakeMask, dropOutF.DropoutRatio, dropOutF.maskStack, dropOutF.ForwardKernel, dropOutF);
                    dropOutF.SingleOutputBackward = (y, x) => DropOutF.SingleOutputBackward(y, x, dropOutF.maskStack, dropOutF.BackwardKernel);
                    break;

                case Dropout <double> dropOutD:
                    dropOutD.SingleInputForward   = x => DropOutD.SingleInputForward(x, CPU.DropOutD.MakeMask, dropOutD.DropoutRatio, dropOutD.maskStack, dropOutD.ForwardKernel, dropOutD);
                    dropOutD.SingleOutputBackward = (y, x) => DropOutD.SingleOutputBackward(y, x, dropOutD.maskStack, dropOutD.BackwardKernel);
                    break;
                }
            }
        }