当前位置:网站首页>[pytorch] common functions
[pytorch] common functions
2022-04-21 22:22:00 【Coke Daniel】
Here's the catalog title
tensor
establish :

Get shape :shape perhaps size function
Add :torch.add(x,y,out=y), There are other ways, of course , But this is the best way !
Indexes : And numpy similar
Other selection functions :

Change shape :view function ,1、 And you can use -1 Indicates that the system automatically calculates ,x=torch.randn(15).view(-1,5);2、view Back to tensor Original tensor Shared memory , You can start with clone In the use of view,y=x.clonew().view(15).
take tensor Convert to python Of number:item function
Line generation function :

tensor turn numpy:tensor.numpy()
numpy turn tensor:torch.from_numpy()
to function take Tensor You put it on the device
版权声明
本文为[Coke Daniel]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212214481447.html
边栏推荐
猜你喜欢
随机推荐
Database design and Implementation
汇编编写中断
Software testing process and testing model
INT 102_ TTL 09
[webgl] simple tutorial
Gd32f303 learning notes (1) -- setting up environment, compiling and writing
逻辑控制(实例讲解)
CC10000.MySQL———————————————
CC00004. ZABBIX———————————————
Causes of segment errors and simple debugging methods (no problem in raspberry pie compilation and segmentation fault in runtime)
排序方式(8种)详解6—快速排序
UVM First Steps with UVM - Register Layer
Opencv -- geometric transformation
L1-055 谁是赢家 (10 分)
[ES6] module import and export
Kotlin core programming, Android development, interview answer handler
CC00012.ZABBIX———————————————
Start debugging the dynamic linker of C Library-2 -- musl-c
[ES6] iterator and forof loop
[WebGIS] Introduction to WebGIS, desktop GIS, mobile GIS and 3D GIS








