当前位置:网站首页>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)
边栏推荐
- Monitoring and management of JVM
- 【翻译】后台项目加入了CNCF孵化器
- [fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)
- GBase 8c系统表pg_cast
- GBase 8c系统表-pg_amop
- Gbase 8C system table PG_ amproc
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
- Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
- [principles of multithreading and high concurrency: 1_cpu multi-level cache model]
- Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers
猜你喜欢

Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???

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

Classes and objects - initialization and cleanup of objects - constructor call rules
![[shutter] banner carousel component (shutter_wiper plug-in | swiper component)](/img/a6/5c97ef3f34702b83ebf0511501d757.gif)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)

Add automatic model generation function to hade

Kubernetes cluster log and efk architecture log scheme
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane
![[translation] the background project has joined the CNCF incubator](/img/0b/e3d2674b1a1cba3ea398cbcb1a018a.png)
[translation] the background project has joined the CNCF incubator

《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨

How to change the panet layer in yolov5 to bifpn
随机推荐
Gbase 8C system table PG_ amop
Gbase 8C system table PG_ auth_ members
超好用的日志库 logzero
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
Gbase 8C function / stored procedure parameters (I)
C语言中左值和右值的区别
Concrete CMS vulnerability
leetcode540
为什么会选择框架?选择什么样的框架
GBase 8c 函数/存储过程定义
Monitoring and management of JVM
HW initial preparation
A2L file parsing based on CAN bus (2)
xiaodi-笔记
Principle and application of database
Informatics Olympiad one general question bank 1006 a+b questions
【 tutoriel】 Chrome ferme les cors et les messages de la politique inter - domaines et apporte des cookies à travers les domaines
左值右指解释的比较好的
Getting started | jetpack hilt dependency injection framework
[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)