How to get index.cuda?
I am reading a code about CMC downloaded from github, and it can't work on vscode.
Code:
if torch.cuda.is_available():
        index = index.cuda(async=True)
        inputs = inputs.cuda()

Error message is as follows:
  File &quot;e:\CMC-master\train_CMC.py&quot;, line 219
    index = index.cuda(async=True)
                       ^
SyntaxError: invalid syntax

How to fix it?

Try using non_blocking=True instead:
index = index.cuda(non_blocking=True)

See Tensor.cuda for more information, and this answer.
