Bendtorch.ce_pick2: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 3200-3205 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=3200&end_line=3205 import Base # loss - log_softmax(x)[y], log_softmax as PyTorch computes it: (x[y] - m) - log(sum exp(x - m)) (since 2026-10-18; it # was loss - log(max(p[y], 1e-12)), which capped a row's loss at 27.63 where PyTorch's grows, NOTES) def ce_pick2(+xy: F32, loss: F32, r: CSM) -> AS: match r: case CSM{z, +m, +ls}: AS{z, (loss - ((xy - m : F32) - ls : F32) : F32)} Uses (4): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=AS https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=CSM