I get the error that test_target can’t use the .cuda():
Traceback (most recent call last):
File "test_loocv.py", line 239, in <module>:
test_target = test_target.cuda()
AttributeError: 'int' object has no attribute 'cuda'
Whatever is coming out of image_datasets['train'][idx] is not a tensor. You can try wrapping test_data and test_target like this: test_data = torch.tensor(test_data) and see if that works.