def gr_2
import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpuimport Base
import bendtorch@1.3.0.0/main.bend as T
846# backward 2: row r of P by the softmax, then G's row: s = dP·P over the i + 1 positions and G = (P * (dP - s)) * sc,
847# main.bend's gr3 and g_set2
848def gr_2(+n: Nat, +off: U32, +sc: F32, g: Array<F32>, r: T.PC) -> T.A2:
849 match r:
850 case T.PC{p, c}: T.g_set2(n, sc, off, T.dot0(n, off, off, 1, 1, g, p))