import torch
from torch.autograd import Variable
print(torch.__version__)
x = Variable(torch.rand(2,3,4).cuda())
y = torch.arange(0,3).type(torch.cuda.LongTensor)
z = torch.arange(0,3).type(torch.LongTensor)
print(x[:,y]) # works
print(x[:,z]) # does not work
In the latest pytorch versions 0.4.0a0+f8439c2 and 0.4.0a0+66547ca the error message for last line is:
RuntimeError: Expected object of type Variable[torch.LongTensor] but found type Variable[torch.cuda.LongTensor] for argument #1 'other'
which is exactly the opposite of what's supposed to work. Also, it is showing the wrong type for z in the message there.
This was not a problem in pytorch version 0.2.0_3 where the error message is:
TypeError: indexing a tensor with an object of type torch.LongTensor. The only supported types are integers, slices, numpy scalars and torch.cuda.LongTensor or torch.cuda.ByteTensor as the only argument.
In the latest pytorch versions
0.4.0a0+f8439c2and0.4.0a0+66547cathe error message for last line is:which is exactly the opposite of what's supposed to work. Also, it is showing the wrong
typeforzin the message there.This was not a problem in pytorch version
0.2.0_3where the error message is: