I am trying to index a tensor in the following line:
neg_dists = distances[0, max_pos_distances_idx[0], 1:]
I get the following error:
TypeError: Performing basic indexing on a tensor and encountered an error indexing dim 1 with an object of type Variable. The only supported types are integers, slices, numpy scalars, or if indexing with a torch.cuda.LongTensor or torch.cuda.ByteTensor only a single Tensor may be passed.
The error message says that I can not index with an object of type Variable, but only index with torch.cuda.LongTensor or torch.cuda.ByteTensor, but if I print max_pos_distances_idx, it reports that it is a ByteTensor:
Variable containing:
0
2
0
0
1
2
0
6
2
0
0
0
0
1
5
2
4
0
0
4
[torch.cuda.ByteTensor of size 20 (GPU 0)]
What am I doing wrong here?
Thanks in advance,