当前位置:网站首页>How to implement append in tensor
How to implement append in tensor
2022-07-03 02:43:00 【strawberry47】
Law 1 : Use list append, Again 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)
Law two : Use it directly 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_ collation
- GBase 8c触发器(三)
- GBase 8c系统表-pg_am
- tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
- The difference between left value and right value in C language
- The core idea of performance optimization, dry goods sharing
- 为什么会选择框架?选择什么样的框架
- GBase 8c系统表-pg_amproc
- JS的装箱和拆箱
- 【教程】chrome关闭跨域策略cors、samesite,跨域带上cookie
猜你喜欢

定了,就选它

"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b

Linear rectification function relu and its variants in deep learning activation function

Pytest (6) -fixture (Firmware)

超好用的日志库 logzero
![[shutter] banner carousel component (shutter_wiper plug-in | swiper component)](/img/a6/5c97ef3f34702b83ebf0511501d757.gif)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)

easyPOI

Build a private cloud disk cloudrev

【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)

HTB-Devel
随机推荐
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
tensor中的append应该如何实现
Your family must be very poor if you fight like this!
简单理解svg
5. File operation
[translation] the background project has joined the CNCF incubator
What does "where 1=1" mean
Gbase 8C system table PG_ database
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
Pytest (6) -fixture (Firmware)
Word word word
Restcloud ETL cross database data aggregation operation
random shuffle注意
The Linux server needs to install the agent software EPS (agent) database
Can netstat still play like this?
Matlab tips (24) RBF, GRNN, PNN neural network
sql server 查询指定表的表结构
easyExcel
Gbase 8C system table PG_ am
Practice of traffic recording and playback in vivo