law product_replayed

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

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

313# product_ordered in transport form, as matmul_replayed states matmul: for
314# every P, if P holds for every result that hands back both inputs with
315# their words and gives an output of the plan's shape whose cells hold the
316# ordered totals, then P holds for the product. The output is a replayed
317# tensor, so a later family law applies to it.
318law product_replayed:
319  for +lo: Matrix.Order
320  for +ro: Matrix.Order
321  for +left: Shape.Shape
322  for +right: Shape.Shape
323  for +plan: Matrix.Product<lo, ro, left, right>
324  for planned: {Matrix.product_plan(lo, ro, left, right) == Done{plan} : Result<&2, &2, Matrix.Error, Matrix.Product<lo, ro, left, right>>}
325  for +left_fill: F32
326  for +left_ops: List<&2, StorageLaws.Op>
327  for -left_fits: {Lifecycle.logical_length(Replayed.storage(left, left_fill, left_ops)) == Shape.logical_numel(Shape.dimensions(left)) : Nat}
328  for +right_fill: F32
329  for +right_ops: List<&2, StorageLaws.Op>
330  for -right_fits: {Lifecycle.logical_length(Replayed.storage(right, right_fill, right_ops)) == Shape.logical_numel(Shape.dimensions(right)) : Nat}
331  for -P: Result<&2, &1, Matrix.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic> -> Type
332  for h: ProductWith(lo, ro, left, right, plan, left_fill, left_ops, right_fill, right_ops, P)
333  P(Matrix.product(lo, ro, Core.Packed{left, Core.TTensor{Replayed.storage(left, left_fill, left_ops), left_fits}},
334    Core.Packed{right, Core.TTensor{Replayed.storage(right, right_fill, right_ops), right_fits}}))

Uses (20)

Used by (2)