def contribute

bendtorch-core@0.1.0.0 · src/autograd/reduce_LAWS.bend:41

import bendtorch-core@0.1.0.0/src/autograd/reduce_LAWS.bend as ReduceLAWS
import Base

41def contribute(+values: List<&2, F32>, +target_index: U32, total: Maybe<&2, F32>, offsets: Maybe<&1, U32 & U32>) -> Maybe<&2, F32>:
42  match offsets:
43    case None{}:
44      None{}
45    case Some{pair}:
46      (target_offset, source_offset) = pair
47      matched(total, word_at(values, U32.to_nat(source_offset)), Nat.is_eq(U32.to_nat(target_offset), U32.to_nat(target_index)))

Uses (10)

Used by (3)