Array API compatible wrapper for :py:func:`np.matmul `. See its docstring for more information.
(x1: Array, x2: Array, /)
| 148 | |
| 149 | # Note: matmul is the numpy top-level namespace but not in np.linalg |
| 150 | def matmul(x1: Array, x2: Array, /) -> Array: |
| 151 | """ |
| 152 | Array API compatible wrapper for :py:func:`np.matmul <numpy.matmul>`. |
| 153 | |
| 154 | See its docstring for more information. |
| 155 | """ |
| 156 | # Note: the restriction to numeric dtypes only is different from |
| 157 | # np.matmul. |
| 158 | if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes: |
| 159 | raise TypeError('Only numeric dtypes are allowed in matmul') |
| 160 | |
| 161 | return Array._new(np.matmul(x1._array, x2._array)) |
| 162 | |
| 163 | |
| 164 | # Note: the name here is different from norm(). The array API norm is split |