Torch.matmul doesn't exist anymore?

Hi!

So…this might be a silly question, but where is matmul?
As can be seen from the code below from my Python interpreter,
mm works fine (as well as @, which might or might not be the same as mm or matmul , I am not sure),

but matmul doesn’t seem to exist in neither torch or a Tensor object.
What’s going on?!

>>> import torch
>>> a=torch.randn(5,6)
>>> b=torch.randn(6,7)
>>> a.mm(b)

 1.3938  1.3466  1.8738  2.9177 -2.7334  1.9803  0.1643
 1.2277  1.2948  2.2676  1.6977 -2.8532  5.0795  2.0144
-1.9988  0.2808 -1.6006 -2.8685  0.5934  0.1643  0.1560
-0.6365 -1.3311 -4.0025 -2.5772  0.5418 -2.0688  1.9729
-0.3097  0.3623  1.6439  0.3341  1.5335 -2.8216 -2.1900
[torch.FloatTensor of size 5x7]

>>> a.matmul(b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'torch.FloatTensor' object has no attribute 'matmul'
>>> torch.matmul(b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch' has no attribute 'matmul'

I believe toch.matmul is present since v0.2. What is your torch.__version__?

0.1.12_2

Thanks, it was only a few months from the point when I installed it.
I guess things are moving super fast :slight_smile:

Will torch.mm to be deprecated in later release, as there is torch.matmul

2 Likes