当前位置:网站首页>torch stack() meshgrid()
torch stack() meshgrid()
2022-06-30 17:35:00 【GY-赵】
x= torch.arange(4)
y= torch.arange(4)
#输入为一维序列,输出两个二维网格,常用来生成坐标
ox,oy = torch.meshgrid([x,y])
#按照某个维度拼接,输入序列shape必须一致,默认按照dim0
o2 = torch.stack((ox,oy))
print(ox,oy)
print(o2,o2.shape)
tensor([[0, 0, 0, 0],
[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3, 3]])
tensor([[0, 1, 2, 3],
[0, 1, 2, 3],
[0, 1, 2, 3],
[0, 1, 2, 3]])
相当于(0,0)(0,1)…两个二维张量相同位置元素对就是一个坐标
tensor([[[0, 0, 0, 0],
[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3, 3]],
[[0, 1, 2, 3],
[0, 1, 2, 3],
[0, 1, 2, 3],
[0, 1, 2, 3]]]) torch.Size([2, 4, 4])
边栏推荐
- Dependencies tool to view exe and DLL dependencies
- MySQL advanced - Architecture
- 分布式场景下,你知道有几种生成唯一ID的方式嘛?
- 如何做好软件系统的需求调研,七种武器让你轻松搞定
- MySQL n'a pas pu trouver MySQL. Solution temporaire pour le fichier Sock
- 抖音最新Xbogus,signature生成js逆向分析
- The online procurement system of the electronic components industry accurately matches the procurement demand and leverages the digital development of the electronic industry
- 先写API文档还是先写代码?
- 麻烦问下 Flink支持同步数据到 sqlserver么
- Four tips tell you how to use SMS to promote business sales?
猜你喜欢

Teach you to quickly set up a live studio in 30 minutes

MySQL advanced - Architecture

屏幕显示技术进化史

秉持'家在中国'理念 2022 BMW儿童交通安全训练营启动
Do you really understand the persistence mechanism of redis?

小程序容器技术,促进园区运营效率提升

AI chief architect 10-aica-lanxiang, propeller frame design and core technology

Volcano engine was selected into the first "panorama of edge computing industry" in China

PHP uses queues to solve maze problems

Countdowncatch and completabilefuture and cyclicbarrier
随机推荐
Classic problem of leetcode dynamic programming (I)
ForkJoinPool
Rhai 脚本引擎的简单应用示例
Sword finger offer 16 Integer power of numeric value
Dlib库实现人脸关键点检测(Opencv实现)
Electronic components bidding and purchasing Mall: optimize traditional purchasing business and speed up enterprise digital upgrading
Flink系列:checkpoint调优
【合集- 行业解决方案】如何搭建高性能的数据加速与数据编排平台
NFT technology for gamefi chain game system development
Hcip (Huawei Senior Network Security Engineer) (Experiment 8) (MPLS basic experiment)
TeamTalk WinClient编译问题及解决方案
MySQL advanced - Architecture
PyTorch学习(三)
屏幕显示技术进化史
depends工具查看exe和dll依赖关系
漏洞复现----35、uWSGI PHP 目录遍历漏洞 (CVE-2018-7490)
MRO industrial products procurement management system: enable MRO enterprise procurement nodes to build a new digital procurement system
Sword finger offer 17 Print from 1 to maximum n digits
「经验」我对用户增长的理解『新用户篇』
Digital intelligent supplier management system solution for coal industry: data driven, supplier intelligent platform helps enterprises reduce costs and increase efficiency