当前位置:网站首页>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)
边栏推荐
- Basic operation of binary tree (C language version)
- QT qcombobox add qccheckbox (drop-down list box insert check box, including source code + comments)
- [shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
- Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
- Informatics Olympiad one general question bank 1006 a+b questions
- Word word word
- Today, it's time to copy the bottom!
- 错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
- 2022-2028 global splicing display industry research and trend analysis report
- Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
猜你喜欢

Add MDF database file to SQL Server database, and the error is reported
![Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid](/img/32/25771baad1ed06c5a592087df748f1.jpg)
Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid

4. Classes and objects

Can netstat still play like this?

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

xiaodi-笔记
![[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)

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

基于线程池的生产者消费者模型(含阻塞队列)

【翻译】具有集中控制平面的现代应用负载平衡
随机推荐
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
HW initial preparation
【翻译】具有集中控制平面的现代应用负载平衡
The Linux server needs to install the agent software EPS (agent) database
A2L file parsing based on CAN bus (2)
Why choose a frame? What frame to choose
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
Cvpr2022 remove rain and fog
Gbase 8C system table PG_ database
Awk from getting started to being buried (2) understand the built-in variables and the use of variables in awk
面试项目技术栈总结
基于can总线的A2L文件解析(2)
Apple releases MacOS 11.6.4 update: mainly security fixes
Practice of traffic recording and playback in vivo
GBase 8c系统表-pg_auth_members
Producer consumer model based on thread pool (including blocking queue)
Javescript 0.1 + 0.2 = = 0.3 problem
Baidu map - surrounding search
Gbase 8C system table PG_ cast
C语言中左值和右值的区别