How we can multiply matrix by using tensor.matmul
Anybody help me in this logic and why we need this
Hi @hamzach1288
matmul function is used to perform matrix multiplication of two tensors.
Syntax - torch.matmul(input, other, *, out=None)
- input – the first tensor to be multiplied
- other – the second tensor to be multiplied
Returns: out – the output tensor.
Eg:
tensor1 = torch.randn(10, 3, 4)
tensor2 = torch.randn(4, 5)
torch.matmul(tensor1, tensor2).size()