Pytorch查看GPU信息

1、查看cuda是否可用:torch.cuda.is_available()

>>> import torch
>>> torch.cuda.is_available()
True

2、查看GPU数量:torch.cuda.device_count()

>>> torch.cuda.device_count()
1

3、查看GPU型号,设备索引默认从0开始:torch.cuda.get_device_name(0)

>>> torch.cuda.get_device_name(0)
'NVIDIA T4 32GB'

4、查看当前设备索引:torch.cuda.current_device()

>>> torch.cuda.current_device()
0

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
乘风的头像乘风管理团队
上一篇 2023年9月15日
下一篇 2023年9月15日

相关推荐