law matmul_replayed

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

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/contracts/replayed.bend as Replayed

201# matmul_ordered in the transport form of broadcast_to_replayed: for every P,
202# if P holds for every result that hands back both inputs with their words and
203# gives an output of the plan's shape whose cells hold the ordered totals,
204# then P holds for the product. The output is a replayed tensor, so a later
205# family law applies to it.
206law matmul_replayed:
207  for +left: Shape.Shape
208  for +right: Shape.Shape
209  for +plan: Matrix.Plan<left, right>
210  for planned: {Matrix.plan(left, right) == Done{plan} : Result<&2, &2, Matrix.Error, Matrix.Plan<left, right>>}
211  for +left_fill: F32
212  for +left_ops: List<&2, StorageLaws.Op>
213  for -left_fits: {Lifecycle.logical_length(Replayed.storage(left, left_fill, left_ops)) == Shape.logical_numel(Shape.dimensions(left)) : Nat}
214  for +right_fill: F32
215  for +right_ops: List<&2, StorageLaws.Op>
216  for -right_fits: {Lifecycle.logical_length(Replayed.storage(right, right_fill, right_ops)) == Shape.logical_numel(Shape.dimensions(right)) : Nat}
217  for -P: Result<&2, &1, Matrix.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic> -> Type
218  for h: MatmulWith(left, right, plan, left_fill, left_ops, right_fill, right_ops, P)
219  P(Matrix.matmul(Core.Packed{left, Core.TTensor{Replayed.storage(left, left_fill, left_ops), left_fits}},
220    Core.Packed{right, Core.TTensor{Replayed.storage(right, right_fill, right_ops), right_fits}}))

Uses (19)

Used by (2)