Did torch.gather change in new pytorch version?
Before I upgraded to the latest pytorch, this command worked for me: ss = pp.gather(1, labels) <SCODE>Variable containing:
 0.0651  0.9349
 0.6208  0.3792
 0.3024  0.6976
 0.2226  0.7774
 0.0394  0.9606
 0.4197  0.5803
 0.1205  0.8795
 0.3774  0.6226
 0.1682  0.8318
 0.2281  0.7719
 0.3845  0.6155
 0.4658  0.5342
 0.4982  0.5018
 0.2653  0.7347
 0.2694  0.7306
 0.6550  0.3450
[torch.cuda.FloatTensor of size 16x2 (GPU 0)]
<ECODE> <SCODE>Variable containing:
 1
 1
 1
 1
 1
 1
 1
 1
 0
 0
 0
 0
 0
 0
 0
 0
[torch.cuda.LongTensor of size 16 (GPU 0)]
<ECODE> However after I upgraded to the latest version off of master, this same line gives me the following error: *** RuntimeError: Input tensor must have same dimensions as output tensor at /data/pytorch/torch/lib/THC/generic/THCTensorScatterGather.cu:16
Kalamaya
The answer, is that labels needs to be reshaped, into an explicit 16x1 vector, from the 16 it is at. Therefore, doing labels.view(-1,1) will make it work.
Kalamaya
RuntimeError: Index tensor must have same dimensions as input tensor at /home/jdily/Desktop/project/lib/pytorch/torch/lib/THC/generic/THCTensorScatterGather.cu:111 And there is no error when running under cpu mode. thx!
jdily
Maybe you are affected by this.
smth