def gather
bendtorch-core@0.1.0.0 · src/autograd/reduce_parallel_proof.bend:112
import bendtorch-core@0.1.0.0/src/autograd/reduce_parallel_proof.bend as ReduceParallelProof
import Base
import bendtorch-core@0.1.0.0/src/autograd/reduce_LAWS.bend as ReduceLaws
112
113def gather(+values: List<&2, F32>, positions: List<&2, Nat>, total: Maybe<&2, F32>) -> Maybe<&2, F32>:
114 match positions:
115 case Nil{}:
116 total
117 case position <> rest:
118 gather(values, rest, ReduceLaws.add_word(total, ReduceLaws.word_at(values, position)))