Skip to contents

Mm

Usage

torch_mm(self, mat2, out_dtype)

Arguments

self

(Tensor) the first matrix to be multiplied

mat2

(Tensor) the second matrix to be multiplied

out_dtype

(torch_dtype, optional) the output dtype

Note

This function does not broadcast . For broadcasting matrix products, see torch_matmul.

mm(input, mat2, out=NULL) -> 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.

Examples

if (torch_is_installed()) {

mat1 = torch_randn(c(2, 3))
mat2 = torch_randn(c(3, 3))
torch_mm(mat1, mat2)
}
#> torch_tensor
#> -0.4376 -3.2749 -0.2625
#> -0.1030 -2.2526 -0.8571
#> [ CPUFloatType{2,3} ]