law sum_ordered
import bendtorch-core@0.1.0.0/src/tensor/contracts/LAWS.bend as LAWSimport 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/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reduction
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import bendtorch-core@0.1.0.0/src/tensor/contracts/sum.bend as Sum
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold_records.bend as FoldRecords
79# Ordered-fold family, sum instance: the sum of a replayed input succeeds with
80# `Reduction.sequential_sum` of all its words in index order, starting at
81# +0.0, and the returned input keeps every word.
82law sum_ordered:
83 for +shape: Shape.Shape
84 for +fill: F32
85 for +ops: List<&2, StorageLaws.Op>
86 for -fits: {Lifecycle.logical_length(Replayed.storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}
87 FoldRecords.FoldContract<shape, Reduction.sequential_sum(words(shape, fill, ops, Shape.logical_numel(Shape.dimensions(shape))), 0.0),
88 other => Replayed.value(shape, fill, ops, other),
89 Sum.sum(Core.Packed{shape, Core.TTensor{Replayed.storage(shape, fill, ops), fits}})>
Uses (17)
Used by (0)
No other definition uses this definition.