public CcSgd( float momentum = 0.0f, float rescaleGrad = 1, Dictionary <int, string> paramIdx2Name = null, float wd = 0, float clipGradient = -1, float learningRate = 0.01F, LrScheduler lrScheduler = null, Symbol sym = null, int beginNumUpdate = 0) : base(rescaleGrad, paramIdx2Name, wd, clipGradient, learningRate, lrScheduler, sym, beginNumUpdate) { this._momentum = momentum; }
public Optimizer(float rescaleGrad = 1.0f, Dictionary <int, string> paramIdx2Name = null, float wd = 0f, float clipGradient = -1.0f, float learningRate = 0.01f, LrScheduler lrScheduler = null, Symbol sym = null, int beginNumUpdate = 0) { this._rescaleGrad = rescaleGrad; this._lr = learningRate; this._lrScheduler = lrScheduler; if (lrScheduler != null) { this._lrScheduler.BaseLr = learningRate; } this._wd = wd; this._lrMult = new Dictionary <string, float>(); this._wdMult = new Dictionary <string, float>(); this._beginNumUpdate = beginNumUpdate; this._numUpdate = beginNumUpdate; this._indexUpdateCount = new Dictionary <int, int>(); this._clipGradient = clipGradient; if (paramIdx2Name == null) { paramIdx2Name = new Dictionary <int, string>(); } this._idx2Name = paramIdx2Name.ToDictionary(entry => entry.Key, entry => entry.Value); this._sym = sym; this.set_lr_mult(new Dictionary <string, float>()); this.set_wd_mult(new Dictionary <string, float>()); }
public CcSgd( float momentum = 0.0f, float rescaleGrad = 1, Dictionary <int, string> paramIdx2Name = null, float wd = 0, float clipGradient = -1, float learningRate = 0.01F, LrScheduler lrScheduler = null, Symbol sym = null, int beginNumUpdate = 0) : base(rescaleGrad, paramIdx2Name, wd, clipGradient, learningRate, lrScheduler, sym, beginNumUpdate) { this._momentum = momentum; this._handle = Optimizer._init_cc_optimizer( "ccsgd", new[] { "momentum", "rescale_grad", "clip_gradient" }, new[] { momentum.ToString(CultureInfo.InvariantCulture), rescaleGrad.ToString(CultureInfo.InvariantCulture), clipGradient.ToString(CultureInfo.InvariantCulture) }); }