I'm trying to run this PyTorch code:
for i, (input, target) in enumerate(train_loader):
input = input.float().cuda(async=True)
target = target.cuda(async=True)
input_var = torch.autograd.Variable(input)
target_var = torch.autograd.Variable(target)
output = model(input_var)
But when I try I am getting this error message:
input = input.float().cuda(async=True)
^
SyntaxError: invalid syntax
Process finished with exit code 1
What am I doing wrong? I already installed cuda.