def dot_ordered

bendtorch-core@0.1.0.0 · src/tensor/contracts/dot_proof.bend:127

import bendtorch-core@0.1.0.0/src/tensor/contracts/dot_proof.bend as DotProof
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/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/dot_fold.bend as DotFold
import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold.bend as Fold
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold_records.bend as Records
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold_proof.bend as Proof
import bendtorch-core@0.1.0.0/src/tensor/contracts/dot.bend as Dot
import bendtorch-core@0.1.0.0/src/tensor/contracts/LAWS.bend as Laws

127def dot_ordered(+rows: Nat, +inner: Nat, +columns: Nat, +row: Nat, +row_below: {Nat.is_lt(row, rows) == True{} : Bool},
128  +column: Nat, +column_below: {Nat.is_lt(column, columns) == True{} : Bool},
129  +left: Shape.Shape, +left_extents: {Shape.extents(left) == [rows, inner] : List<&2, Nat>},
130  +left_fill: F32, +left_ops: List<&2, StorageLaws.Op>,
131  -left_fits: {Lifecycle.logical_length(Replayed.storage(left, left_fill, left_ops)) == Shape.logical_numel(Shape.dimensions(left)) : Nat},
132  +right: Shape.Shape, +right_extents: {Shape.extents(right) == [inner, columns] : List<&2, Nat>},
133  +right_fill: F32, +right_ops: List<&2, StorageLaws.Op>,
134  -right_fits: {Lifecycle.logical_length(Replayed.storage(right, right_fill, right_ops)) == Shape.logical_numel(Shape.dimensions(right)) : Nat}) ->
135  Records.PairFoldContract<left, right,
136    DotFold.dot_fold(Laws.factors(row, column, inner, columns, left, left_fill, left_ops, right, right_fill, right_ops, inner), 0.0),
137    other => Replayed.value(left, left_fill, left_ops, other),
138    other => Replayed.value(right, right_fill, right_ops, other),
139    Dot.dot(Dot.Cell{row, column, inner, columns},
140      Core.Packed{left, Core.TTensor{Replayed.storage(left, left_fill, left_ops), left_fits}},
141      Core.Packed{right, Core.TTensor{Replayed.storage(right, right_fill, right_ops), right_fits}})>:
142  +cell : Dot.Cell = Dot.Cell{row, column, inner, columns}
143  %total_factors(row, column, inner, columns, left, left_fill, left_ops, right, right_fill, right_ops, inner) :
144    Records.PairFoldContract<left, right, _,
145      other => Replayed.value(left, left_fill, left_ops, other),
146      other => Replayed.value(right, right_fill, right_ops, other),
147      Fold.pair_run(~Unit, ~Dot.multiply_add, ~Dot.Cell, ~Dot.left_index, ~Dot.right_index, Unit{}, cell, inner,
148        Core.Packed{left, Core.TTensor{Replayed.storage(left, left_fill, left_ops), left_fits}},
149        Core.Packed{right, Core.TTensor{Replayed.storage(right, right_fill, right_ops), right_fits}})>
150  Proof.pair_contract(~Unit, ~Dot.multiply_add, ~Dot.Cell, ~Dot.left_index, ~Dot.right_index, Unit{}, cell,
151    left, left_fill, left_ops, right, right_fill, right_ops, inner,
152    left_inside(rows, inner, columns, row, column, row_below, left, left_extents, inner, Conversion.le_reflexive(inner)),
153    right_inside(inner, columns, row, column, column_below, right, right_extents, inner, Conversion.le_reflexive(inner)),
154    left_fits, right_fits)

Uses (30)

Used by (1)