oneflow.mm

oneflow.mm(input, mat2)Tensor

Performs a matrix multiplication of the matrices input and mat2.

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 does not broadcast. For broadcasting matrix products, see oneflow.matmul().

The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.mm.html.

Parameters
Returns

The result Tensor

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> mat1 = flow.randn(2, 3)
>>> mat2 = flow.randn(3, 3)
>>> of_out = flow.mm(mat1, mat2)
>>> of_out.shape
oneflow.Size([2, 3])