缘由
步骤安装CUDA环境最近看很多人说Tensoflow,准备转型Pytorch,然后刚好搭建Tensoflow-gpu,搭建好了CUDA环境,就尝试安装了一下!
去官网选自己环境配置获取安装代码具体可以参考https://www.emperinter.info/2020/07/28/tensorflow-gpu-support/
- https://pytorch.org/get-started/locally/
- 如为Windows平台+ Pip包管理 + Python语言 + CUDA10.2则会获取到
pip install torch===1.5.1 torchvision===0.6.1 -f https://download.pytorch.org/whl/torch_stable.html测试
- 测试CUDA是否可用
import torchprint(torch.cuda.is_available())
结果应为: True
- 简单����,���测试
from __future__ import print_functionimport torchx = torch.rand(5, 3)print(x)
结果类似与:
tensor([[0.0730, 0.5183, 0.0066], [0.6899, 0.4511, 0.3222], [0.6566, 0.9099, 0.4501], [0.3694, 0.5197, 0.9324], [0.5693, 0.2476, 0.2959]])