>>> import torch
>>> torch.cuda.is_available()
True
>>> torch.cuda.device_count()
1
>>> torch.zeros(1).cuda()
runtimeError: CUDA error: no kernel image is available for execution on the device
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.
重新安装cuda
根据https://pytorch.org/get-started/previous-versions/ 查看pytorch 和cuda 对应版本