Exemple #1
0
        public GradientClipping(T threshold)
        {
            this.Threshold = threshold;

            switch (this)
            {
            case GradientClipping <float> gradientClippingF:
                gradientClippingF.Update = () => GradientClippingF.Update(gradientClippingF.Threshold, gradientClippingF.FunctionParameters);
                break;

            case GradientClipping <double> gradientClippingD:
                gradientClippingD.Update = () => GradientClippingD.Update(gradientClippingD.Threshold, gradientClippingD.FunctionParameters);
                break;
            }
        }
Exemple #2
0
        public GradientClipping(T threshold)
        {
            this.Threshold = threshold;

            switch (this)
            {
            case GradientClipping <float> gradientClippingF:
                gradientClippingF.Update = () => OptimizerF.Update(gradientClippingF);
                gradientClippingF.UpdateFunctionParameters = (i) => GradientClippingF.UpdateFunctionParameters(gradientClippingF.Threshold, gradientClippingF.FunctionParameters[i]);
                break;

            case GradientClipping <double> gradientClippingD:
                gradientClippingD.Update = () => OptimizerD.Update(gradientClippingD);
                gradientClippingD.UpdateFunctionParameters = (i) => GradientClippingD.UpdateFunctionParameters(gradientClippingD.Threshold, gradientClippingD.FunctionParameters[i]);
                break;
            }
        }