public Optimizer SetLearningRateScheduler(UniquePtr <LRScheduler> lrScheduler) { Logging.CHECK(lrScheduler); UniquePtr <LRScheduler> .Move(lrScheduler, out this._LearningRateScheduler); this.LearningRateScheduler.Ptr.SetLearningRate(float.Parse(this.Params["lr"])); return(this); }
private static IDictionary <string, NDArray> GetDictionary(IList <string> names, IList <NDArray> arrays) { var ret = new Dictionary <string, NDArray>(); var set = new HashSet <string>(); foreach (var s in names) { Logging.CHECK(set.Contains(s), $"Duplicate names detected, {s}"); set.Add(s); } Logging.CHECK_EQ(set.Count, arrays.Count, "names size not equal to arrays size"); for (var i = 0; i < names.Count; ++i) { ret[names[i]] = arrays[i]; } return(ret); }