module 'torch.cuda' has no attribute 'is_avaliable'
时间: 2023-09-21 21:03:23 浏览: 222
torch-cuda-cu
The correct attribute name is `torch.cuda.is_available()`.
You can use this attribute to check if the CUDA is available on your system or not. This attribute returns a Boolean value indicating whether CUDA is currently available or not.
Here's an example:
```
import torch
if torch.cuda.is_available():
print("CUDA is available on this system.")
else:
print("CUDA is not available on this system.")
```
阅读全文