【pytorch】查看torch的gpu是否可用

torch.cuda.is_available()
cuda是否可用;

torch.cuda.device_count()
返回gpu數量;

torch.cuda.get_device_name(0)
返回gpu名字,設備索引默認從0開始;

torch.cuda.current_device()
返回當前設備索引;
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章