怎么用 pytorch 查看 GPU 信息

 如果你用的 Keras 或者 TensorFlow, 请移步 怎么查看keras 或者 tensorflow 正在使用的GPU

注意:一定要安装对应CUDA版本的Pytorch, 否则可能pytorch 识别不了你的GPU

 

In [1]: import torch

In [2]: torch.cuda.current_device()
Out[2]: 0

In [3]: torch.cuda.device(0)
Out[3]: <torch.cuda.device at 0x7efce0b03be0>

In [4]: torch.cuda.device_count()
Out[4]: 1

In [5]: torch.cuda.get_device_name(0)
Out[5]: 'GeForce GTX 950M'

In [6]: torch.cuda.is_available()
Out[6]: True







posted @ 2019-07-02 18:21  mashuai_191  阅读(14644)  评论(0编辑  收藏  举报