.. _l-onnx-doc-MatMul: ====== MatMul ====== .. contents:: :local: .. _l-onnx-op-matmul-13: MatMul - 13 =========== **Version** * **name**: `MatMul (GitHub) `_ * **domain**: **main** * **since_version**: **13** * **function**: False * **support_level**: SupportType.COMMON * **shape inference**: True This version of the operator has been available **since version 13**. **Summary** Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html **Inputs** * **A** (heterogeneous) - **T**: N-dimensional matrix A * **B** (heterogeneous) - **T**: N-dimensional matrix B **Outputs** * **Y** (heterogeneous) - **T**: Matrix multiply results from A * B **Type Constraints** * **T** in ( tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64) ): Constrain input and output types to float/int tensors. **Examples** **default** :: node = onnx.helper.make_node( "MatMul", inputs=["a", "b"], outputs=["c"], ) # 2d a = np.random.randn(3, 4).astype(np.float32) b = np.random.randn(4, 3).astype(np.float32) c = np.matmul(a, b) expect(node, inputs=[a, b], outputs=[c], name="test_matmul_2d") # 3d a = np.random.randn(2, 3, 4).astype(np.float32) b = np.random.randn(2, 4, 3).astype(np.float32) c = np.matmul(a, b) expect(node, inputs=[a, b], outputs=[c], name="test_matmul_3d") # 4d a = np.random.randn(1, 2, 3, 4).astype(np.float32) b = np.random.randn(1, 2, 4, 3).astype(np.float32) c = np.matmul(a, b) expect(node, inputs=[a, b], outputs=[c], name="test_matmul_4d") **Differences** .. raw:: html
00Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.htmlMatrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html
11
22**Inputs****Inputs**
33
44* **A** (heterogeneous) - **T**:* **A** (heterogeneous) - **T**:
55 N-dimensional matrix A N-dimensional matrix A
66* **B** (heterogeneous) - **T**:* **B** (heterogeneous) - **T**:
77 N-dimensional matrix B N-dimensional matrix B
88
99**Outputs****Outputs**
1010
1111* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
1212 Matrix multiply results from A * B Matrix multiply results from A * B
1313
1414**Type Constraints****Type Constraints**
1515
1616* **T** in (* **T** in (
17 tensor(bfloat16),
1718 tensor(double), tensor(double),
1819 tensor(float), tensor(float),
1920 tensor(float16), tensor(float16),
2021 tensor(int32), tensor(int32),
2122 tensor(int64), tensor(int64),
2223 tensor(uint32), tensor(uint32),
2324 tensor(uint64) tensor(uint64)
2425 ): ):
2526 Constrain input and output types to float/int tensors. Constrain input and output types to float/int tensors.
.. _l-onnx-op-matmul-9: MatMul - 9 ========== **Version** * **name**: `MatMul (GitHub) `_ * **domain**: **main** * **since_version**: **9** * **function**: False * **support_level**: SupportType.COMMON * **shape inference**: True This version of the operator has been available **since version 9**. **Summary** Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html **Inputs** * **A** (heterogeneous) - **T**: N-dimensional matrix A * **B** (heterogeneous) - **T**: N-dimensional matrix B **Outputs** * **Y** (heterogeneous) - **T**: Matrix multiply results from A * B **Type Constraints** * **T** in ( tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64) ): Constrain input and output types to float/int tensors. **Differences** .. raw:: html
00Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.htmlMatrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html
11
22**Inputs****Inputs**
33
44* **A** (heterogeneous) - **T**:* **A** (heterogeneous) - **T**:
55 N-dimensional matrix A N-dimensional matrix A
66* **B** (heterogeneous) - **T**:* **B** (heterogeneous) - **T**:
77 N-dimensional matrix B N-dimensional matrix B
88
99**Outputs****Outputs**
1010
1111* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
1212 Matrix multiply results from A * B Matrix multiply results from A * B
1313
1414**Type Constraints****Type Constraints**
1515
1616* **T** in (* **T** in (
1717 tensor(double), tensor(double),
1818 tensor(float), tensor(float),
1919 tensor(float16) tensor(float16),
20 tensor(int32),
21 tensor(int64),
22 tensor(uint32),
23 tensor(uint64)
2024 ): ):
2125 Constrain input and output types to float tensors. Constrain input and output types to float/int tensors.
.. _l-onnx-op-matmul-1: MatMul - 1 ========== **Version** * **name**: `MatMul (GitHub) `_ * **domain**: **main** * **since_version**: **1** * **function**: False * **support_level**: SupportType.COMMON * **shape inference**: True This version of the operator has been available **since version 1**. **Summary** Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html **Inputs** * **A** (heterogeneous) - **T**: N-dimensional matrix A * **B** (heterogeneous) - **T**: N-dimensional matrix B **Outputs** * **Y** (heterogeneous) - **T**: Matrix multiply results from A * B **Type Constraints** * **T** in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.