BendTensors.Flat.rowexp.step: def of bend-tensors@0.0.0.2 Import: import bend-tensors@0.0.0.2/bend_tensors.bend as BendTensors Lines 1934-1938 of bend-tensors@0.0.0.2/bend_tensors.bend: https://jend.leeeet.dev/read.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&start_line=1934&end_line=1938 import Base # exp(x - mx) written back, the row's sum answered def Flat.rowexp.step(+i: U32, +mx: F32, r: Array & F32, +acc: F32) -> Array & F32: (a, x) = r +y = F32.exp((x - mx : F32)) (Array.set(F32, a, i, y), (acc + y : F32)) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array 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.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.exp https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub 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