Python 如何获取index.cuda?

Python 如何获取index.cuda?,python,pytorch,Python,Pytorch,我正在阅读从github下载的关于CMC的代码,但它无法在vscode上运行 代码: 错误消息如下: File "e:\CMC-master\train_CMC.py", line 219 index = index.cuda(async=True) ^ SyntaxError: invalid syntax 如何修复它?尝试改用非阻塞=True: index=index.cuda(非阻塞=True) 有关更多信息

我正在阅读从github下载的关于CMC的代码,但它无法在vscode上运行

代码:

错误消息如下:

  File "e:\CMC-master\train_CMC.py", line 219
    index = index.cuda(async=True)
                       ^
SyntaxError: invalid syntax

如何修复它?

尝试改用
非阻塞=True

index=index.cuda(非阻塞=True)

有关更多信息,请参阅,然后回答。

您的pytorch版本是什么?什么cuda工具包版本?pytorch:'1.7.0+cu110'cuda工具包:11.1
  File "e:\CMC-master\train_CMC.py", line 219
    index = index.cuda(async=True)
                       ^
SyntaxError: invalid syntax