We may see @ operation in pytorch script. For example:
What does it mean? In this tutorial, we will introduce it for you.
@ in pytorch
In pytorch, @ operation is equal to torch.matmul().
The Difference Between torch.matmul() and torch.mul() – PyTorch Tutorial
For example:
import torch x = torch.randn(3, 2) y = torch.randn(2, 2) z = x @ y m = torch.matmul(x, y) print("z=",z) print("m=",m)
Run this code, we will see:
z= tensor([[ 0.5852, 0.6192], [ 0.9816, 1.6204], [-0.3757, -1.5175]]) m= tensor([[ 0.5852, 0.6192], [ 0.9816, 1.6204], [-0.3757, -1.5175]])
Here z and m are the same. It means:
@ = torch.matmul()