def adam_m
import bendtorch@1.3.0.0/main.bend as Bendtorchimport Base
273# c1 = 1 - b1 and c2 = 1 - b2 are given as their own constants (0.1, 0.001), as PyTorch computes 1 - beta in float64
274# before rounding: 1 - b2 taken in F32 from b2 = 0.999 (0.99900001287 in F32) is 1.3e-5 too small, and over 100 steps
275# that alone put the tiny Llama 21x further from float64 than PyTorch's float32 (NOTES, 2026-10-18)
276def adam_m(+c1: F32, +m: F32, +g: F32) -> F32:
277 (m + (c1 * (g - m : F32) : F32) : F32)