Reduce.strided_run: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce Lines 119-129 of bendtorch-core@0.1.0.0/src/autograd/reduce.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/autograd/reduce.bend&start_line=119&end_line=129 import Base # The fuel + 1 words at offsets base + step * d + lift for d = digit, digit + # 1, ..., added to `accumulator` in that order; `pair` is the read of the # first. Each step reads the next word and hands it on as an argument. def strided_run(fuel: Nat, +step: Nat, +base: Nat, +digit: Nat, +lift: Nat, accumulator: F32, pair: Array & F32) -> F32 & Array: match fuel pair: case 0n Tuple{array, word}: (F32.add(accumulator, word), array) case 1n+remaining Tuple{array, word}: strided_run(remaining, step, base, 1n+digit, lift, F32.add(accumulator, word), Array.get(F32, array, U32.from_nat(strided_offset(step, base, 1n+digit, lift)))) 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.get 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=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.from_nat https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/reduce.bend&name=strided_offset