device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
t = torch.tensor([1,2], device=device)
但是我遇到了一个奇怪的错误。
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
即使将该环境变量设置为1,似乎也没有显示任何进一步的细节。
有人遇到过这个问题吗?