Tensor Multiplication in PyTorch with torch.matmul() function with Examples
Introduction
In this tutorial, we will explain how to multiply tensors in PyTorch with torch.matmul() function. We will see its syntax and see various examples to understand its functionality in a better way.
Syntax of torch.matmul() function
The syntax of torch matmul function is as follows –
torch.matmul(tensor1, tensor2, out)
- tensor1 – The first tensor for multiplication
- tensor2 – The second tensor for multiplication
- out – Output tensor, result of multiplication of tensor1 with tensor2