ubuntu系统下,指定了device为"cuda",torch.cuda.is_available()也显示 True ,但是训练时查看GPU占用显示为0 。
>>> import torch
>>> print(torch.cuda.get_device_name())
NVIDIA GeForce RTX 3090
>>> print(torch.__version__)
1.12.1+cu116
>>> print(torch.version.cuda)
11.6
>>> x = torch.randn(1).cuda()
>>> print(x)
tensor([0.9615], device='cuda:0')
为此新建了一个环境重新在根据官网pip torch,但是没有用。
Ans: 因为数据很大,前面数据读了很长时间…读取的时候不用使用GPU。。。