law matmul_ordered

bendtorch-core@0.1.0.0 · src/tensor/contracts/LAWS.bend:148

import bendtorch-core@0.1.0.0/src/tensor/contracts/LAWS.bend as LAWS
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/matmul.bend as Matrix
import bendtorch-core@0.1.0.0/src/tensor/dot_fold.bend as DotFold
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import bendtorch-core@0.1.0.0/src/tensor/contracts/dot.bend as Dot
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold_records.bend as FoldRecords

148# Ordered-fold family, matmul: for every plan of a product of two replayed
149# matrices, matmul succeeds with a rows x columns output whose cell
150# (row, column) holds `DotFold.dot_fold` of the cell's factor pairs in
151# increasing k, starting at +0.0, the value `dot_ordered` states for
152# `Dot.dot`, and both returned inputs keep every word.
153law matmul_ordered:
154  for +left: Shape.Shape
155  for +right: Shape.Shape
156  for +plan: Matrix.Plan<left, right>
157  for planned: {Matrix.plan(left, right) == Done{plan} : Result<&2, &2, Matrix.Error, Matrix.Plan<left, right>>}
158  for +left_fill: F32
159  for +left_ops: List<&2, StorageLaws.Op>
160  for -left_fits: {Lifecycle.logical_length(Replayed.storage(left, left_fill, left_ops)) == Shape.logical_numel(Shape.dimensions(left)) : Nat}
161  for +right_fill: F32
162  for +right_ops: List<&2, StorageLaws.Op>
163  for -right_fits: {Lifecycle.logical_length(Replayed.storage(right, right_fill, right_ops)) == Shape.logical_numel(Shape.dimensions(right)) : Nat}
164  FoldRecords.MatmulContract<left, right, matrix_rows(left, right, plan), matrix_columns(left, right, plan),
165    row => column => DotFold.dot_fold(factors(row, column, matrix_inner(left, right, plan), matrix_columns(left, right, plan),
166      left, left_fill, left_ops, right, right_fill, right_ops, matrix_inner(left, right, plan)), 0.0),
167    other => Replayed.value(left, left_fill, left_ops, other),
168    other => Replayed.value(right, right_fill, right_ops, other),
169    Matrix.matmul(Core.Packed{left, Core.TTensor{Replayed.storage(left, left_fill, left_ops), left_fits}},
170      Core.Packed{right, Core.TTensor{Replayed.storage(right, right_fill, right_ops), right_fits}})>

Uses (24)

Used by (0)

No other definition uses this definition.