I’m getting this error saying:
RuntimeError: Expected object of type torch.LongTensor but found type torch.IntTensor for argument #3 'index'
Here is a full traceback.
Traceback (most recent call last):
File "main.py", line 156, in <module>
train(args, model, train_loader, eval_loader, args.epochs, args.output, optim, epoch)
File "E:\pyprojects\MICCAI19-MedVQA-master\train.py", line 81, in train
for i, (v, q, a, _, _, _) in enumerate(train_loader):
File "E:\Anaconda\envs\pt\lib\site-packages\torch\utils\data\dataloader.py", line 314, in __next__
batch = self.collate_fn([self.dataset[i] for i in indices])
File "E:\Anaconda\envs\pt\lib\site-packages\torch\utils\data\dataloader.py", line 314, in <listcomp>
batch = self.collate_fn([self.dataset[i] for i in indices])
File "E:\pyprojects\MICCAI19-MedVQA-master\dataset_RAD.py", line 243, in __getitem__
target.scatter_(0, labels, scores)
RuntimeError: Expected object of type torch.LongTensor but found type torch.IntTensor for argument #3 'index'
But what does it mean by argument #3 "index"
? I can’t find "index
" argument, and I don’t know how to change the data type of the lables
in target.scatter_(0, lables, scores)
.
Any comment (even though it’s short!) or just listing keywords to look at will be highly appreciated!
The code comes from an open source project: MICCAI19-MedVQA/README.md at master · aioz-ai/MICCAI19-MedVQA (github.com)