BendtorchGpu.mulb_loop: def of bendtorch-gpu@1.3.0.0 Import: import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpu Lines 120-126 of bendtorch-gpu@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-gpu@1.3.0.0/main.bend&start_line=120&end_line=126 import Base import bend-ml-tensor-gpu@0.1.5.0/main.bend as TG # x1 = dy; the saved a and b, written in place: a becomes db = dy * a and b becomes da = dy * b, in one bang def mulb_loop(k: Nat, +i: U32, +l: U32, rd: Array & F32, ra: Array & F32, rb: Array & F32) -> TG.O2: match k rd ra rb: case 0n Tuple{d, +x} Tuple{a, +y} Tuple{b, +z}: TG.O2{a, b} case 1n+q Tuple{d, +x} Tuple{a, +y} Tuple{b, +z}: +u = (i + l : U32) mulb_loop(q, u, l, Array.get(F32, d, u), Array.get(F32, Array.set(F32, a, i, (x * y : F32)), u), Array.get(F32, Array.set(F32, b, i, (x * z : F32)), u)) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.set https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma 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=bend-ml-tensor-gpu@0.1.5.1/main.bend&name=O2