当前位置:网站首页>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)
边栏推荐
- Gbase 8C system table PG_ database
- Cvpr2022 remove rain and fog
- Tongda OA V12 process center
- Two dimensional format array format index subscript continuity problem leads to return JSON format problem
- GBase 8c 函数/存储过程参数(二)
- GBase 8c 创建用户/角色 示例二
- 错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
- leetcode540
- 【翻译】具有集中控制平面的现代应用负载平衡
- Interview stereotyped version
猜你喜欢

Awk from introduction to earth (0) overview of awk
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane

Thread safe singleton mode
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/7e/ad9ea78868126b149bd9f15f587e6c.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信

The data in servlet is transferred to JSP page, and the problem cannot be displayed using El expression ${}

Detailed analysis of micro service component sentinel (hystrix)

Kubernetes family container housekeeper pod online Q & A?
![ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc](/img/cb/145937a27ef08050a370d5a255215a.jpg)
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc

内存池(内核角度理解new开辟空间的过程)
随机推荐
Pytest (6) -fixture (Firmware)
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
左值右指解释的比较好的
Cvpr2022 remove rain and fog
Classes and objects - initialization and cleanup of objects - constructor call rules
Gbase 8C function / stored procedure parameters (II)
awk从入门到入土(3)awk内置函数printf和print实现格式化打印
Build a private cloud disk cloudrev
Matlab tips (24) RBF, GRNN, PNN neural network
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
GBase 8c系统表-pg_aggregate
【 tutoriel】 Chrome ferme les cors et les messages de la politique inter - domaines et apporte des cookies à travers les domaines
Gbase 8C system table PG_ database
A2L file parsing based on CAN bus (2)
Current situation and future of Web3 in various countries
MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
Random shuffle note
Random Shuffle attention
JS的装箱和拆箱
random shuffle注意