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())
相关文章
相关标签/搜索