Why I cannot perform dot operation on two matrices?
print(S.shape, S.dtype)
print(G.shape, G.dtype)
torch.dot(S, torch.t(G))
torch.Size([256, 31360]) torch.int16
torch.Size([1825, 31360]) torch.int16
RuntimeError: _th_dot not supported on CUDAType for Short
Could please sure a code that can reproduces this error?
The problem is torch.dot() only supports 1D tensors. So, the error should be about it. The alternatives function for 2D and 3D (batch-wise) is torch.mm and torch.bmm respectively.
Here is the code I used to produce your case (although could not get your error):
a = torch.randint(high=10, size=(5, 7), dtype=torch.int16)
b = torch.randint(high=10, size=(5, 7), dtype=torch.int16)
torch.dot(a, torch.t(b))
# output
# RuntimeError: 1D tensors expected, got 2D, 2D tensors at /pytorch/aten/src/TH/generic/THTensorEvenMoreMath.cpp:431