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# The fuel + 1 words at offsets base + step * d + lift for d = digit, digit +
120# 1, ..., added to `accumulator` in that order; `pair` is the read of the
121# first. Each step reads the next word and hands it on as an argument.
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))))

Uses (9)

Used by (3)