小编Soy*_*ong的帖子

Pytorch .to('cuda') 或 .cuda() 不起作用并且卡住了

我正在尝试做 pytorch 教程。当我尝试将他们的设备设置为 cuda 时,它不起作用并且我的代码运行被卡住。

具体信息,我使用的是 python 3.7.3 pytorch 1.3.0 cuda 10.2 (NVIDIA RTX2080TI) 的 conda 环境

>>> import torch
>>> torch.cuda.is_available()
True
>>> torch.cuda.device_count()
1
>>> torch.cuda.current_device()
0
>>> device = torch.device('cuda:0')
>>> device
device(type='cuda', index=0)
>>> aa = torch.randn(5)
>>> aa = tensor([-2.2084, -0.2700, 0.0921, -1.7678, 0.7642])
>>> aa.to(device)


nothing happens...
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我如何克服这个问题吗?

python pytorch

5
推荐指数
1
解决办法
7842
查看次数

标签 统计

python ×1

pytorch ×1