当前位置:网站首页>[pytorch learning] torch device
[pytorch learning] torch device
2022-07-01 09:09:00 【Enzo tried to smash the computer】
1. torch.device The meaning of representation
torch.device For and on behalf of torch.tensor The object assigned to the device
( To put it simply , Is assigned to you CPU still GPU On , And which one GPU On )
2. torch.device Parameter interpretation of
torch.device Contains a device type ('cpu’ or ’cuda’ Device type ) And the serial number of the optional device .
If the equipment serial number does not exist , Is the current device
for example ,torch.Tensor Build with equipment ’cuda’ The result is the same as ’cuda:X’, among X yes torch.cuda.current_device() Result .
3. structure torch.device Two ways
- Through strings
>>> torch.device('cpu')
device(type='cpu')
>>> torch.device('cuda:0')
device(type='cuda', index=0)
>>> torch.device('cuda') # current cuda device
device(type='cuda')
- In the form of string and device number
>>> torch.device('cpu', 0)
device(type='cpu', index=0)
>>> torch.device('cuda', 0)
device(type='cuda', index=0)
边栏推荐
- Shell script -select in loop
- Shell script -for loop and for int loop
- Redis源码学习(29),压缩列表学习,ziplist.c(二)
- Understanding and implementation of AVL tree
- Simple load balancing with Nacos
- Nacos - Configuration Management
- Software Engineer Interview Question brushing website and experience method
- Flink interview questions
- Mise en œuvre simple de l'équilibrage de la charge par nacos
- 安装Oracle EE
猜你喜欢

Principles of Microcomputer - internal and external structure of microprocessor

AVL树的理解和实现

钓鱼识别app

Which method is good for the management of fixed assets of small and medium-sized enterprises?

Installing Oracle EE

Why is the Ltd independent station a Web3.0 website!

2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder

Mise en œuvre simple de l'équilibrage de la charge par nacos

Personal decoration notes

NiO zero copy
随机推荐
【检测技术课案】简易数显电子秤的设计与制作
Log4j log framework
毕业季,我想对你说
Understand shallow replication and deep replication through code examples
树结构---二叉树1
Imitation of Baidu search results top navigation bar effect
如何高效拉齐团队认知
Shell script - definition, assignment and deletion of variables
【ESP 保姆级教程 预告】疯狂Node.js服务器篇 ——案例:ESP8266 + DHT11 +NodeJs本地服务+ MySQL数据库
SDN_简单总结
Shell脚本-case in语句
It is designed with high bandwidth, which is almost processed into an open circuit?
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DHT11 +nodejs local service + MySQL database
Flink面试题
Why is the Ltd independent station a Web3.0 website!
Nacos - 配置管理
Microcomputer principle - bus and its formation
Summary of reptile knowledge points
3D printing Arduino four axis aircraft
Serialization, listening, custom annotation