pytorch与gpu信息查询

  • torch.cuda.is_available()

cuda是否可用;

  • torch.cuda.device_count()

返回gpu数量;

  • torch.cuda.get_device_name(0)

返回gpu名字,设备索引默认从0开始;

  • torch.cuda.current_device()

返回当前设备索引

猜你喜欢

转载自blog.csdn.net/weixin_43217427/article/details/114132035