law nt_reads_transpose

bendtorch-core@0.1.0.0 · src/autograd/tensor_vjp_LAWS.bend:442

import bendtorch-core@0.1.0.0/src/autograd/tensor_vjp_LAWS.bend as TensorVjpLAWS
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/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/LAWS.bend as Contracts

442# matmul_nt reads what matmul reads from the transposed copy: for a right
443# operand of dimensions [columns, inner], the factor pairs of cell
444# (row, column) of a product of two `Kept` operands (`matmul_nt`), left[row,
445# k] and right[column, k], are the pairs `right_transposed_factors` reads
446# through `permute_source` on right^T, the pairs `tensor_matmul_vjp_values`
447# states for g @ y^T. Both fold the same words in the same order, so
448# `matmul_nt(g, y)` and `matmul(g, transpose_copy(y))` agree word for word.
449law nt_reads_transpose:
450  for +row: Nat
451  for +column: Nat
452  for +rows: Nat
453  for +left: Shape.Shape
454  for +left_fill: F32
455  for +left_ops: List<&2, StorageLaws.Op>
456  for +right: Shape.Shape
457  for +right_fill: F32
458  for +right_ops: List<&2, StorageLaws.Op>
459  for +columns: U32
460  for +inner: U32
461  for matrix: {Shape.dimensions(right) == [columns, inner] : List<&2, U32>}
462  for column_below: {Nat.is_lt(column, U32.to_nat(columns)) == True{} : Bool}
463  for +count: Nat
464  for room: {Nat.is_le(count, U32.to_nat(inner)) == True{} : Bool}
465  {Contracts.product_factors(row, column, Matrix.Kept{}, Matrix.Kept{}, U32.to_nat(inner), rows, U32.to_nat(columns),
466    left, left_fill, left_ops, right, right_fill, right_ops, count) ==
467    right_transposed_factors(row, column, U32.to_nat(inner), U32.to_nat(columns), left, left_fill, left_ops,
468      right, right_fill, right_ops, swapped(right), count) : List<&2, DotFold.Factors>}

Uses (17)

Used by (0)

No other definition uses this definition.