def pair_total
bendtorch-core@0.1.0.0 · src/tensor/contracts/fold.bend:91
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold.bend as Fold
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/contracts/replayed.bend as Replayed
91def pair_total(~O: Data, ~g: O -> F32 -> F32 -> F32 -> F32, ~P: Data, ~ia: P -> Nat -> Nat, ~ib: P -> Nat -> Nat,
92 +operation: O, +plan: P, +left: Shape.Shape, +left_fill: F32, +left_ops: List<&2, StorageLaws.Op>,
93 +right: Shape.Shape, +right_fill: F32, +right_ops: List<&2, StorageLaws.Op>, +count: Nat) -> F32:
94 match count:
95 case 0n:
96 0.0
97 case 1n+previous:
98 g(operation, pair_total(~O, ~g, ~P, ~ia, ~ib, operation, plan, left, left_fill, left_ops, right, right_fill, right_ops, previous),
99 Replayed.value(left, left_fill, left_ops, U32.from_nat(ia(plan, previous))),
100 Replayed.value(right, right_fill, right_ops, U32.from_nat(ib(plan, previous))))