Pytorch Torch Mm
# PyTorch torch.mm Function
* * Pytorch torch Reference](#)
`torch.mm` is a function in PyTorch used to perform 2D matrix multiplication.
### Function Definition
torch.mm(input, mat2, out)
* * *
## Usage Example
## Example
import torch
A = torch.randn(2,3)
B = torch.randn(3,4)
# Matrix multiplication
C = torch.mm(A, B)
print("A shape:", A.shape)
print("B shape:", B.shape)
print("C shape:", C.shape)
Output result:
A shape: torch.Size([2, 3]) B shape: torch.Size([3, 4]) C shape: torch.Size([2, 4])
* * Pytorch torch Reference](#)
YouTip