This defines tensor operations for 0.3.1 (it does also contain the definitions of the other operators):
https://pytorch.org/docs/0.3.1/_modules/torch/tensor.html
The code for the current stable has been rearranged (I guess they do more in C now), but since the behaviour of matrix multiplication hasn't changed, I think it is save to assume that this is still valid.
See for the definition of __matmul__
:
def __matmul__(self, other):
if not torch.is_tensor(other):
return NotImplemented
return self.matmul(other)
and
def matmul(self, other):
r"""Matrix product of two tensors.
See :func:`torch.matmul`."""
return torch.matmul(self, other)
The operator @
was introduced with PEP 465 and is mapped to __matmul__
.
See also here for this:
What is the '@=' symbol for in Python?