当前位置:网站首页>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)
边栏推荐
猜你喜欢

线程安全的单例模式

where 1=1 是什么意思
![[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)](/img/6e/67bc187a89fb9125856c78c89f7bfb.gif)
[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
[advanced ROS] Lesson 6 recording and playback in ROS (rosbag)

Return a tree structure data

定了,就选它

Pytest (6) -fixture (Firmware)

HW-初始准备

Add MDF database file to SQL Server database, and the error is reported

Choose it when you decide
随机推荐
Summary of interview project technology stack
Gbase 8C function / stored procedure parameters (II)
C语言中左值和右值的区别
awk从入门到入土(1)awk初次会面
Can netstat still play like this?
leetcode540
easyExcel
GBase 8c系统表-pg_amproc
基于线程池的生产者消费者模型(含阻塞队列)
简单理解svg
【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
HW-初始准备
2022-2028 global splicing display industry research and trend analysis report
Gbase 8C system table PG_ conversion
GBase 8c 创建用户/角色 示例二
GBase 8c 函数/存储过程参数(二)
xiaodi-笔记
GBase 8c系统表-pg_am
【翻译】Flux安全。通过模糊处理获得更多信心
Gbase 8C system table PG_ database