当前位置:网站首页>tensor中的append应该如何实现
tensor中的append应该如何实现
2022-07-03 02:39:00 【strawberry47】
法一:使用list append,再concat
import torch
T1 = torch.tensor([1,2,5,4]).unsqueeze_(0)
T2 = torch.tensor([1,2,3,4]).unsqueeze_(0)
T3 = torch.tensor([2,2,3,4]).unsqueeze_(0)
a = []
a.append(T1)
a.append(T2)
a.append(T3)
c = torch.cat(a,dim=0)
法二:直接使用concat
for i in range(12):
b = torch.randn(3)
b.unsqueeze_(0)
if i == 0:
a = b
else:
a = torch.cat((a, b), dim=0)
边栏推荐
- Practice of traffic recording and playback in vivo
- SQL statement
- Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
- Basic operation of binary tree (C language version)
- Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
- Monitoring and management of JVM
- [flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)
- awk从入门到入土(2)认识awk内置变量和变量的使用
- [translation] the background project has joined the CNCF incubator
- 《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
猜你喜欢
![[translation] the background project has joined the CNCF incubator](/img/0b/e3d2674b1a1cba3ea398cbcb1a018a.png)
[translation] the background project has joined the CNCF incubator
![[hcia]no.15 communication between VLANs](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[hcia]no.15 communication between VLANs
【ROS进阶篇】第六讲 ROS中的录制与回放(rosbag)

Check log4j problems using stain analysis
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信

easyPOI

random shuffle注意

Create + register sub apps_ Define routes, global routes and sub routes
![[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)](/img/e5/c01f760b07b495f5b048ea367e0c21.gif)
[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
随机推荐
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
Gbase 8C system table PG_ collation
Gbase 8C function / stored procedure parameters (II)
Choose it when you decide
内存池(内核角度理解new开辟空间的过程)
Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
【翻译】具有集中控制平面的现代应用负载平衡
Two dimensional format array format index subscript continuity problem leads to return JSON format problem
Tongda OA homepage portal workbench
How to change the panet layer in yolov5 to bifpn
Gbase 8C trigger (II)
Gbase 8C system table PG_ conversion
Cvpr2022 remove rain and fog
定了,就选它
[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
awk从入门到入土(2)认识awk内置变量和变量的使用
sql server 查詢指定錶的錶結構
Baidu map - surrounding search
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
GBase 8c系统表-pg_am