torch.device使用方法

torch.device使用方法 torch.device表明將torch.Tensor分配到的設備的對象,有cpu和cuda兩種,這裏的cuda就是gpu,至於爲何不直接用gpu與cpu對應,是由於gpu的編程接口採用的是cudapython print(torch.cuda.is_available()) #cuda是否可用; print(torch.cuda.device_count())
相關文章
相關標籤/搜索