def facts_compatible

bendtorch-core@0.1.0.0 · src/tensor/contracts/matmul_proof.bend:49

import bendtorch-core@0.1.0.0/src/tensor/contracts/matmul_proof.bend as MatmulProof
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
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

49def facts_compatible(-left: Shape.Shape, -right: Shape.Shape, +rows: U32, +inner: U32, +right_inner: U32, +columns: U32,
50  le: {Shape.dimensions(left) == [rows, inner] : List<&2, U32>},
51  re: {Shape.dimensions(right) == [right_inner, columns] : List<&2, U32>},
52  decision: Shape.BoolCase<Nat.is_eq(U32.to_nat(inner), U32.to_nat(right_inner))>) ->
53  Facts(left, right, Matrix.plan_compatible(left, right, rows, inner, right_inner, columns, le, re, decision)):
54  match decision:
55    case Shape.BFalse{equal}:
56      Unit{}
57    case Shape.BTrue{equal}:
58      facts_output(left, right, rows, inner, right_inner, columns, le, re,
59        Lifecycle.natural_equal(U32.to_nat(inner), U32.to_nat(right_inner), equal), Shape.construct([rows, columns]))

Uses (13)

Used by (1)