In the below code,
model_ft.eval()
test_data, test_target = image_datasets['train'][idx]
test_data = test_data.cuda()
test_target = test_target.cuda()

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'

How should I fix this?