Python/torch

来自康健生活
Kangkk​(留言 | 贡献)2021年11月7日 (日) 07:45的版本 (→引言)

引言

安装

/home/kangkk
pip3 install torch

验证

testtorch.py
import torch
x = torch.rand(5, 3)
print(x)

是否启用了 CUDA 驱动程序。

testtorchiscuda.py
import torch
torch.cuda.is_available()