当前位置:网站首页>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)
边栏推荐
- Linear rectification function relu and its variants in deep learning activation function
- Gbase 8C system table PG_ attribute
- Practice of traffic recording and playback in vivo
- What does "where 1=1" mean
- Gbase 8C system table PG_ amproc
- Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
- Detailed analysis of micro service component sentinel (hystrix)
- Gbase 8C system table PG_ authid
- Gbase 8C system table PG_ auth_ members
- random shuffle注意
猜你喜欢
![[shutter] banner carousel component (shutter_wiper plug-in | swiper component)](/img/a6/5c97ef3f34702b83ebf0511501d757.gif)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane

Baidu map - surrounding search

Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution

Random shuffle note

Return a tree structure data

MATLAB小技巧(24)RBF,GRNN,PNN-神经网络

The use of Flink CDC mongodb and the implementation of Flink SQL parsing complex nested JSON data in monggo
![[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]

random shuffle注意
随机推荐
GBase 8c系统表-pg_conversion
Gbase 8C system table PG_ attribute
C语言中左值和右值的区别
Informatics Olympiad one general question bank 1006 a+b questions
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
The Linux server needs to install the agent software EPS (agent) database
leetcode540
Summary of interview project technology stack
Gbase 8C system table PG_ database
Gbase 8C function / stored procedure definition
【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
内存池(内核角度理解new开辟空间的过程)
Interview stereotyped version
Gbase 8C system table PG_ aggregate
SQL statement
Apple releases MacOS 11.6.4 update: mainly security fixes
[translation] the background project has joined the CNCF incubator
GBase 8c系统表-pg_authid
javeScript 0.1 + 0.2 == 0.3的问题
The data in servlet is transferred to JSP page, and the problem cannot be displayed using El expression ${}