在使用专业数据库软件pytorch时都会需要查看gpu信息,很多小伙伴不明白pytorch如何查看gpu,下面叫我们来看看如何使用pytorch查看 gpu 信息?
pytorch是什么?
pytorch是一个开源的python机器学习库,基于torch,用于自然语言处理等应用程序,前身是torch,其底层和torch框架一样,但是使用python重新写了很多内容,不仅更加灵活,支持动态图,而且提供了python接口。是一个以python优先的深度学习框架,不仅能够实现强大的gpu加速,同时还支持动态神经网络。
使用pytorch 查看 gpu 信息
输入下面代码就可以查看gpu信息
in[1]:importtorchin[2]:torch.cuda.current,device()out[2]:0in[3]:torch.cuda.device(0)out[3]:<torch.cuda.deviceat0x7efce0b03be0>in[4]:torch.cuda.device,count()out[4]:1in[5]:torch.cuda.get,device,name(0)out[5]:'geforcegtx950m'in[6]:torch.cuda.is,available()out[6]:true