当前位置:网站首页>gpu加速pytorch能用吗?
gpu加速pytorch能用吗?
2022-06-13 00:38:00 【程序媛珂珂】
这篇文章主要介绍了判断pytorch是否支持GPU加速的操作,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教。如何判断pytorch是否支持GPU加速?你关心的问题,解答来了。
gpu加速pytorch能用吗?
加上这句代码:
print torch.cuda.is_available()True
判断完毕!说说在pytorch中如何查看gpu信息吧~
为什么将数据转移至GPU的方法叫做.cuda而不是.gpu,就像将数据转移至CPU调用的方法是.cpu?这是因为GPU的编程接口采用CUDA,而目前并不是所有的GPU都支持CUDA,只有部分Nvidia的GPU才支持。
PyTorch未来可能会支持AMD的GPU,而AMD GPU的编程接口采用OpenCL,因此PyTorch还预留着.cl方法,用于以后支持AMD等的GPU。
torch.cuda.is_available()cuda是否可用;
torch.cuda.device_count()返回gpu数量;
torch.cuda.get_device_name(0)返回gpu名字,设备索引默认从0开始;
torch.cuda.current_device()返回当前设备索引;

以上为个人经验,希望能给大家一个参考。
免费分享一些我整理的人工智能学习资料给大家,包括一些AI常用框架实战视频、图像识别、OpenCV、NLQ、机器学习、计算机视觉、深度学习与神经网络等视频、课件源码、国内外知名精华资源、AI热门论文、行业报告等。
为了更好的系统学习AI,推荐大家收藏一份。
下面是部分截图,文末附免费下载方式。
一、人工智能课程及项目

二、国内外知名精华资源

三、人工智能论文合集

四、人工智能行业报告

学好人工智能,要多看书,多动手,多实践,要想提高自己的水平,一定要学会沉下心来慢慢的系统学习,最终才能有所收获。
点击下方名片,扫码免费下载文中资料。
边栏推荐
- [sca-cnn interpretation] spatial and channel wise attention
- Antdpro - protable realizes the linkage effect of two selection boxes
- Go custom collation
- kotlin 协程withContext切换线程
- Composite key relationships using Sqlalchemy - relationships on composite keys using Sqlalchemy
- Context of go concurrency mode
- Daily buckle exercise - conclusion
- Mysql批量插入数据时如何解决重复问题?
- 也许尘埃落地,我们才能想清楚互联网的本质
- Comparison of disk partition modes (MBR and GPT)
猜你喜欢

ROS2之OpenCV人脸识别foxy~galactic~humble

Kalix system - use of information collection gadgets
![Buuctf's babysql[geek challenge 2019]](/img/6c/957e5e09f252210d0b4cf8771d4ade.png)
Buuctf's babysql[geek challenge 2019]

MySQL lpad() and rpad() concatenate string functions with specified length

Stm32f4 development of DMA transmission to GPIO port
![[Error] invalid use of incomplete type 使用了未定义的类型](/img/8a/7cb5d270cfd8831ddc146687fe4499.png)
[Error] invalid use of incomplete type 使用了未定义的类型

Hard (magnetic) disk (I)

Kotlin 协程的四种启动模式

In / out / inout details of MySQL stored procedures

Target recognition gadget
随机推荐
Daily buckle exercise - conclusion
Static analysis of malicious code
Hard (magnetic) disk (I)
[gxyctf2019] no dolls -- detailed explanation
[colorful] Net dto mapping
Leetcode weekly -- April to May
What are the conditions of index invalidation?
杂记:intel11代和12代移动版支持原生Thunderbolt4接口,桌面版不支持
高阶极点对于波形的影响
Kotlin 协程挂起函数 suspend 关键字
Kotlin 协程,job的生命周期
睡前小故事之MySQL起源
Buuctf's babysql[geek challenge 2019]
Basic operations of FreeMarker
Build your own PE manually from winpe of ADK
Assembly language learning
[error] invalid use of incomplete type uses an undefined type
[LeetCode]1. Sum of two numbers thirty-four
今日睡眠质量记录74分
Opencv face recognition of ros2 foxy~galactic~humble