Bendtorch.OptCfg.ok: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 521-532 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=521&end_line=532 import Base # True unless an Adam configuration's c1, c2 disagree with its b1, b2. Train.new poisons the state of a configuration # that fails (every loss after the first is NaN); a program checks it first with OptCfg.check to stop with a message. def OptCfg.ok(+cfg: OptCfg) -> Bool: match cfg: case CAdam{lr, b1, b2, eps, wd, c1, c2}: Bool.and(beta_ok(b1, c1), beta_ok(b2, c2)) case CAdamW{lr, b1, b2, eps, wd, c1, c2}: Bool.and(beta_ok(b1, c1), beta_ok(b2, c2)) case CAdamWBF16{lr, b1, b2, eps, wd, c1, c2, v16}: Bool.and(beta_ok(b1, c1), beta_ok(b2, c2)) case _: True{} Uses (4): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=OptCfg https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=beta_ok