mindspore.ops.mm

View Source On Gitee
mindspore.ops.mm(input, mat2)[source]

Returns the matrix product of two arrays.

If input is a \((n \times m)\) tensor, mat2 is a \((m \times p)\) tensor, out will be a \((n \times p)\) tensor.

Note

  • This function cannot support broadcasting. Refer to mindspore.ops.matmul() instead if you need a broadcastable function.

  • On Ascend, float64 doesn't be supported.

Parameters
  • input (Tensor) – The first matrix of matrix multiplication.

  • mat2 (Tensor) – The second matrix of matrix multiplication.

Returns

Tensor or scalar

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> out = mindspore.ops.mm(mindspore.ops.ones((2, 3)), mindspore.ops.ones((3, 4)))
>>> print(out.shape)
(2, 4)