def OptCfg.ok

bendtorch@1.3.0.0 · main.bend:521

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base

521# True unless an Adam configuration's c1, c2 disagree with its b1, b2. Train.new poisons the state of a configuration
522# that fails (every loss after the first is NaN); a program checks it first with OptCfg.check to stop with a message.
523def OptCfg.ok(+cfg: OptCfg) -> Bool:
524  match cfg:
525    case CAdam{lr, b1, b2, eps, wd, c1, c2}:
526      Bool.and(beta_ok(b1, c1), beta_ok(b2, c2))
527    case CAdamW{lr, b1, b2, eps, wd, c1, c2}:
528      Bool.and(beta_ok(b1, c1), beta_ok(b2, c2))
529    case CAdamWBF16{lr, b1, b2, eps, wd, c1, c2, v16}:
530      Bool.and(beta_ok(b1, c1), beta_ok(b2, c2))
531    case _:
532      True{}

Uses (4)

Used by (2)