def strided_run
bendtorch-core@0.1.0.0 · src/autograd/reduce.bend:119
import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce
import Base
119
120
121
122def strided_run(fuel: Nat, +step: Nat, +base: Nat, +digit: Nat, +lift: Nat, accumulator: F32, pair: Array<F32> & F32) ->
123 F32 & Array<F32>:
124 match fuel pair:
125 case 0n Tuple{array, word}:
126 (F32.add(accumulator, word), array)
127 case 1n+remaining Tuple{array, word}:
128 strided_run(remaining, step, base, 1n+digit, lift, F32.add(accumulator, word),
129 Array.get(F32, array, U32.from_nat(strided_offset(step, base, 1n+digit, lift))))