def cells

bendtorch-core@0.1.0.0 · src/tensor/contracts/binary_LAWS.bend:12

import bendtorch-core@0.1.0.0/src/tensor/contracts/binary_LAWS.bend as BinaryLAWS
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import bendtorch-core@0.1.0.0/src/tensor/contracts/pointwise.bend as Pointwise
import bendtorch-core@0.1.0.0/src/tensor/contracts/broadcast.bend as Broadcast

12# The words of a pointwise product in index order: word k is
13# scalar(operation, left[left_map(plan, k)], right[right_map(plan, k)]), the
14# value the pointwise family's broadcast instance writes at k.
15def cells(+operation: Elementwise.Operation, +plan: Shape.BroadcastPlan,
16  +left: Shape.Shape, +left_fill: F32, +left_ops: List<&2, StorageLaws.Op>,
17  +right: Shape.Shape, +right_fill: F32, +right_ops: List<&2, StorageLaws.Op>, +count: Nat) -> List<&2, F32>:
18  match count:
19    case 0n:
20      Nil{}
21    case 1n+previous:
22      List.append(&2, F32, cells(operation, plan, left, left_fill, left_ops, right, right_fill, right_ops, previous),
23        [Pointwise.cell(~Elementwise.Operation, ~Elementwise.scalar, ~Shape.BroadcastPlan, ~Broadcast.left_map,
24          ~Broadcast.right_map, operation, plan, left, left_fill, left_ops, right, right_fill, right_ops, previous)])

Uses (12)

Used by (7)