raise the error “index_select received an invalid combination of arguments - got (int, !torch.cuda.LongTensor!), but expected (int dim, torch.LongTensor index)”. I can fix the bug with
But it incurs data exchange b/w GPU and CPU. Is there a more elegant solution? This issue is quite common when you implement some layers which are expected to run on the GPU.
@killeent I don’t understand. Doesn’t your example show that it works fine if both the tensor and the indices are on the GPU? This is certainly how it currently works for me (but maybe this was introduced in pytorch 0.2).
I also get a similar error…Thougn I checked and all my data seems to be on GPU…msg I get:
*** TypeError: torch.index_select received an invalid combination of arguments - got (torch.cuda.FloatTensor, int, torch.cuda.FloatTensor), but expected (torch.cuda.FloatTensor source, int dim, torch.cuda.LongTensor index)