MatMul#

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

 `0` `0` `Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html` `Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html` `1` `1` `2` `2` `**Inputs**` `**Inputs**` `3` `3` `4` `4` `* **A** (heterogeneous) - **T**:` `* **A** (heterogeneous) - **T**:` `5` `5` ` N-dimensional matrix A` ` N-dimensional matrix A` `6` `6` `* **B** (heterogeneous) - **T**:` `* **B** (heterogeneous) - **T**:` `7` `7` ` N-dimensional matrix B` ` N-dimensional matrix B` `8` `8` `9` `9` `**Outputs**` `**Outputs**` `10` `10` `11` `11` `* **Y** (heterogeneous) - **T**:` `* **Y** (heterogeneous) - **T**:` `12` `12` ` Matrix multiply results from A * B` ` Matrix multiply results from A * B` `13` `13` `14` `14` `**Type Constraints**` `**Type Constraints**` `15` `15` `16` `16` `* **T** in (` `* **T** in (` `17` ` tensor(bfloat16),` `17` `18` ` tensor(double),` ` tensor(double),` `18` `19` ` tensor(float),` ` tensor(float),` `19` `20` ` tensor(float16),` ` tensor(float16),` `20` `21` ` tensor(int32),` ` tensor(int32),` `21` `22` ` tensor(int64),` ` tensor(int64),` `22` `23` ` tensor(uint32),` ` tensor(uint32),` `23` `24` ` tensor(uint64)` ` tensor(uint64)` `24` `25` ` ):` ` ):` `25` `26` ` Constrain input and output types to float/int tensors.` ` Constrain input and output types to float/int tensors.`

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

 `0` `0` `Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html` `Matrix product that behaves like numpy.matmul: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.matmul.html` `1` `1` `2` `2` `**Inputs**` `**Inputs**` `3` `3` `4` `4` `* **A** (heterogeneous) - **T**:` `* **A** (heterogeneous) - **T**:` `5` `5` ` N-dimensional matrix A` ` N-dimensional matrix A` `6` `6` `* **B** (heterogeneous) - **T**:` `* **B** (heterogeneous) - **T**:` `7` `7` ` N-dimensional matrix B` ` N-dimensional matrix B` `8` `8` `9` `9` `**Outputs**` `**Outputs**` `10` `10` `11` `11` `* **Y** (heterogeneous) - **T**:` `* **Y** (heterogeneous) - **T**:` `12` `12` ` Matrix multiply results from A * B` ` Matrix multiply results from A * B` `13` `13` `14` `14` `**Type Constraints**` `**Type Constraints**` `15` `15` `16` `16` `* **T** in (` `* **T** in (` `17` `17` ` tensor(double),` ` tensor(double),` `18` `18` ` tensor(float),` ` tensor(float),` `19` `19` ` tensor(float16)` ` tensor(float16),` `20` ` tensor(int32),` `21` ` tensor(int64),` `22` ` tensor(uint32),` `23` ` tensor(uint64)` `20` `24` ` ):` ` ):` `21` `25` ` Constrain input and output types to float tensors.` ` Constrain input and output types to float/int tensors.`

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.