.. _op_ai_onnx_Gemm-7: Gemm - version 7 ================ This page documents version **7** of operator **Gemm**. See :doc:`Gemm` for the latest version (since version 13). - **Domain**: ``ai.onnx`` - **Since version**: 7 General Matrix multiplication: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 A' = transpose(A) if transA else A B' = transpose(B) if transB else B Compute Y = alpha \* A' \* B' + beta \* C, where input tensor A has shape (M, K) or (K, M), input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N), and output tensor Y has shape (M, N). A will be transposed before doing the computation if attribute transA is non-zero, same for B and transB. **Inputs** - **A** (*T*): Input tensor A. The shape of A should be (M, K) if transA is 0, or (K, M) if transA is non-zero. - **B** (*T*): Input tensor B. The shape of B should be (K, N) if transB is 0, or (N, K) if transB is non-zero. - **C** (*T*): Input tensor C. The shape of C should be unidirectional broadcastable to (M, N). **Outputs** - **Y** (*T*): Output tensor of shape (M, N). **Type Constraints** - **T**: Constrain input and output types to float tensors. Allowed types: tensor(double), tensor(float), tensor(float16). Differences with previous version (6) ------------------------------------- **SchemaDiff**: ``Gemm`` (domain ``'ai.onnx'``) * old version: 6 * new version: 7 * breaking: no **Documentation:** * line similarity: 0.21 (+9/-6 lines) .. code-block:: diff --- Gemm v6 +++ Gemm v7 @@ -1,8 +1,11 @@ General Matrix multiplication: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 -Compute Y = alpha * A * B + beta * C, where input tensor A has -dimension (M X K), input tensor B has dimension (K X N), input tensor C and -output tensor Y have dimension (M X N). -If attribute broadcast is non-zero, input tensor C will be broadcasted to match -the dimension requirement. A will be transposed before doing the computation -if attribute transA is non-zero, same for B and transB. + +A' = transpose(A) if transA else A + +B' = transpose(B) if transB else B + +Compute Y = alpha * A' * B' + beta * C, where input tensor A has shape (M, K) or (K, M), +input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N), +and output tensor Y has shape (M, N). A will be transposed before doing the +computation if attribute transA is non-zero, same for B and transB.