当前位置:网站首页>torch.Tensor.to的用法
torch.Tensor.to的用法
2022-07-29 08:04:00 【00000cj】
更改数据类型torch.dtype或者设备torch.device
x = torch.Tensor([1, 2, 3])
print(x.dtype) # torch.float32
x = x.to(torch.int64)
print(x.dtype) # torch.int64
print(x.device) # device(type='cpu')
print(x) # tensor([1, 2, 3])
cuda0 = torch.device('cuda:0')
x = x.to(cuda0)
print(x.device) # device(type='cuda', index=0)
print(x) # tensor([1, 2, 3], device='cuda:0')参考
边栏推荐
- [flask introduction series] installation and configuration of flask Sqlalchemy
- C language data type
- An optimal buffer management scheme with dynamic thresholds paper summary
- Process and concept of process
- [skill accumulation] presentation practical skill accumulation, common sentence patterns
- [note] the art of research (understand the importance of the problem)
- Go 事,如何成为一个Gopher ,并在7天找到 Go 语言相关工作,第1篇
- Ionicons icon Encyclopedia
- Postman interface test | JS script blocking sleep and non blocking sleep
- [untitled] format save
猜你喜欢

Mysql rownum 实现

How to draw an excellent architecture diagram

Up sampling deconvolution operation
![[beauty of software engineering - column notes] 25 | what methods can improve development efficiency?](/img/c8/c2d45abbf36b898040f9f1cf6274ff.png)
[beauty of software engineering - column notes] 25 | what methods can improve development efficiency?

Character shader exercise

Dynamic Thresholds Buffer Management in a Shared Buffer Packet Switch论文总结

The new colleague wrote a few pieces of code, broke the system, and was blasted by the boss!

Unicode私人使用区域(Private Use Areas)

STM32 printf problem summary semihosting microlib understanding

Tle5012b+stm32f103c8t6 (bluepill) reading angle data
随机推荐
UE4 principle and difference between skylight and reflecting sphere
Limitations of push down analysis
[paper reading | cryoet] gum net: fast and accurate 3D subtomo image alignment and average unsupervised geometric matching
Cyberpunk special effect shader
Realize the effect of changing some colors of a paragraph of text
[lecture notes] how to do in-depth learning in poor data?
Up sampling deconvolution operation
Resize2fs: bad magic number in super block
Arduinoide + stm32link burning debugging
Pytorch's skill record
Autojs微信研究:微信自动发送信息机器人最终成品(有效果演示)
The new colleague wrote a few pieces of code, broke the system, and was blasted by the boss!
佳木斯市场监管局开展防疫防虫害专题食品安全网络培训
网络安全之安全基线
C language problems
Some simple uses of crawler requests Library
FLink CDC 的mysql connector中,mysql的字段是varbinary, 官方
Rotation in model space and rotation in world space
[introduction to cryoelectron microscopy] Caltech open class course notes part 3:image formation
Jianmu continuous integration platform v2.5.2 release