CanMatmul:IsMatMulCompatible<A,B>extendstrue ?true :Aextendsreadonly[] ?ShapeError< "Cannot multiply scalar tensors. Matrix multiplication requires at least 1D tensors.", {shapeA:A;shapeB:B}, > :Bextendsreadonly[] ?ShapeError< "Cannot multiply with scalar tensor. Matrix multiplication requires at least 1D tensors.", {shapeA:A;shapeB:B}, > :ShapeError< `Cannot multiply tensors with shapes [${ShapeToString<A>}] and [${ShapeToString< B, >}]. Matrix multiplication requires the last dimension of the first tensor (${LastDim< A, >&number}) to match the ${Bextendsreadonly[unknown] ?"dimension" :"second-to-last dimension"} of the second tensor (${Bextendsreadonly[ unknown, ] ?B[0]&number :SecondToLast<B>&number}).`, {shapeA:A;shapeB:B}, >
Validate if two shapes can be matrix multiplied with detailed error messages
Returns true for compatible shapes, or a ShapeError for incompatible ones.
This provides better developer experience than IsMatMulCompatible which returns boolean.
Validate if two shapes can be matrix multiplied with detailed error messages
Returns true for compatible shapes, or a ShapeError for incompatible ones. This provides better developer experience than IsMatMulCompatible which returns boolean.