当前位置:网站首页>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)
边栏推荐
- UDP receive queue and multiple initialization test
- Awk from introduction to earth (0) overview of awk
- 基于线程池的生产者消费者模型(含阻塞队列)
- Restcloud ETL cross database data aggregation operation
- sql server 查詢指定錶的錶結構
- sql server 查询指定表的表结构
- 【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
- 2022-2028 global splicing display industry research and trend analysis report
- easyPOI
- Gbase 8C system table PG_ attribute
猜你喜欢

Pytest (6) -fixture (Firmware)
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane

HW-初始准备

内存池(内核角度理解new开辟空间的过程)

Pytorch convolution network regularization dropblock

4. Classes and objects

HTB-Devel

Practice of traffic recording and playback in vivo

【翻译】具有集中控制平面的现代应用负载平衡

Xiaodi notes
随机推荐
GBase 8c系统表-pg_amproc
左值右指解释的比较好的
Basic operation of binary tree (C language version)
MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
簡單理解svg
《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
内存池(内核角度理解new开辟空间的过程)
Gbase 8C system table PG_ auth_ members
Javescript 0.1 + 0.2 = = 0.3 problem
Hcip137-147 title + analysis
Gbase 8C create user / role example 2
Build a private cloud disk cloudrev
Informatics Olympiad one general question bank 1006 a+b questions
Gbase 8C system table PG_ amop
What does "where 1=1" mean
GBase 8c系统表-pg_amop
xiaodi-笔记
GBase 8c系统表-pg_attribute
Interview stereotyped version
[fluent] futurebuilder asynchronous programming (futurebuilder construction method | asyncsnapshot asynchronous calculation)