Bendtorch.gnb_sums: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 1945-1952 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=1945&end_line=1952 import Base # the backward pass is LayerNorm's with the block in place of the row: the two means (of dxh and of dxh·xh) are taken # over the whole block, then each cell's dx, dg[ch] += dy·xh and db[ch] += dy, in order def gnb_sums(left: Nat, +off: U32, +j: U32, +c: U32, +cg: Nat, +mu: F32, +r: F32, q: R3SS) -> R3SS: match left q: case 0n t: t case 1n+l R3SS{x, dy, g, +sa, +sb}: gnb_sums(l, (off + c : U32), j, c, cg, mu, r, lnb_sums(Nat.sub(cg, 1n), j, (off + c : U32), mu, r, sa, sb, Array.get(F32, x, ((off + c : U32) + j : U32)), Array.get(F32, dy, ((off + c : U32) + j : U32)), Array.get(F32, g, j))) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=R3SS https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=lnb_sums