def fiber

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

import bendtorch-core@0.1.0.0/src/autograd/reduce_LAWS.bend as ReduceLAWS
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/projection_LAWS.bend as Projection

49# The specified accumulation: start at +0.0 and visit contribution positions
50# 0, 1, ..., count - 1 in ascending order; each position whose independent
51# broadcast projection, Projection.offset_spec, has target_offset equal to
52# target_index adds the word at its source_offset with one F32 add.
53def fiber(+plan: Shape.BroadcastPlan, +values: List<&2, F32>, +target_index: U32, +count: Nat) -> Maybe<&2, F32>:
54  match count:
55    case 0n:
56      Some{0.0}
57    case 1n+position:
58      contribute(values, target_index, fiber(plan, values, target_index, position), Projection.offset_spec(plan, position))

Uses (8)

Used by (21)