[work] 验证pytorch gpu正确安装

野性酷女 2022-04-11 02:43 295阅读 0赞

This is going to work :

  1. In [1]: import torch
  2. In [2]: torch.cuda.current_device()
  3. Out[2]: 0
  4. In [3]: torch.cuda.device(0)
  5. Out[3]: <torch.cuda.device at 0x7efce0b03be0>
  6. In [4]: torch.cuda.device_count()
  7. Out[4]: 1
  8. In [5]: torch.cuda.get_device_name(0)
  9. Out[5]: 'GeForce GTX 950M'

This tells me the GPU GeForce GTX 950M is being used by PyTorch.

发表评论

表情:
评论列表 (有 0 条评论,295人围观)

还没有评论,来说两句吧...

相关阅读

    相关 [work] pytorch切片

    torch 包 `torch` 包含了多维张量的数据结构以及基于其上的多种数学操作。另外,它也提供了多种工具,其中一些可以更有效地对张量和任意类型进行序列化。 它有CUDA