def MatmulGoal
bendtorch-core@0.1.0.0 · src/autograd/tensor_vjp_PROOF.bend:401
import bendtorch-core@0.1.0.0/src/autograd/tensor_vjp_PROOF.bend as TensorVjpPROOF
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/contracts/LAWS.bend as Contracts
import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as Backward
import bendtorch-core@0.1.0.0/src/autograd/tensor_vjp_LAWS.bend as Laws
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
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
401
402def MatmulGoal(+a: Nat, +b: Nat, +left: Shape.Shape, +right: Shape.Shape, +shape: Shape.Shape,
403 +right_plan: Layout.Plan<right, Laws.swapped(right)>, +first: Matrix.Plan<shape, Laws.transposed(right, right_plan)>,
404 +left_plan: Layout.Plan<left, Laws.swapped(left)>, +second: Matrix.Plan<Laws.transposed(left, left_plan), shape>,
405 +fill: F32, +ops: List<&2, StorageLaws.Op>, +left_fill: F32, +left_ops: List<&2, StorageLaws.Op>,
406 +right_fill: F32, +right_ops: List<&2, StorageLaws.Op>, pass: Backward.Pass) -> Type:
407 +flipped = Laws.transposed(right, right_plan)
408 +turned = Laws.transposed(left, left_plan)
409 Laws.MatmulPairContract<a, left, Contracts.matrix_rows(shape, flipped, first), Contracts.matrix_columns(shape, flipped, first),
410 row => column => DotFold.dot_fold(Laws.right_transposed_factors(row, column,
411 Contracts.matrix_inner(shape, flipped, first), Contracts.matrix_columns(shape, flipped, first),
412 shape, fill, ops, right, right_fill, right_ops, Laws.swapped(right), Contracts.matrix_inner(shape, flipped, first)), 0.0),
413 b, right, Contracts.matrix_rows(turned, shape, second), Contracts.matrix_columns(turned, shape, second),
414 row => column => DotFold.dot_fold(Laws.left_transposed_factors(row, column,
415 Contracts.matrix_inner(turned, shape, second), Contracts.matrix_columns(turned, shape, second),
416 left, left_fill, left_ops, Laws.swapped(left), shape, fill, ops, Contracts.matrix_inner(turned, shape, second)), 0.0),
417 pass>