当前位置:网站首页>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])
边栏推荐
- 医疗行业企业供应链系统解决方案:实现医疗数智化供应链协同可视
- mysql for update 死锁问题排查
- 亲测flutter打包apk后大小,比较满意
- Development and construction of NFT mining tour gamefi chain tour system
- Electronic components bidding and purchasing Mall: optimize traditional purchasing business and speed up enterprise digital upgrading
- OneFlow源码解析:算子签名的自动推断
- 充值满赠,IM+RTC+X 全通信服务「回馈季」开启
- Vscode status bar statusbar
- It's not easy to say I love you | use the minimum web API to upload files
- Redis - persistent RDB and persistent AOF
猜你喜欢

Multipass中文文档-设置图形界面

Adhering to the concept of 'home in China', 2022 BMW children's traffic safety training camp was launched

又一篇CVPR 2022论文被指抄袭,平安保险研究者控诉IBM苏黎世团队

Geoffrey Hinton:我的五十年深度学习生涯与研究心法
![The company was jailed for nonstandard bug during the test ~ [cartoon version]](/img/cd/42ab3fc0000fa7dfe2ac89de3486e4.jpg)
The company was jailed for nonstandard bug during the test ~ [cartoon version]

Dlib库实现人脸关键点检测(Opencv实现)

LeetCode之合并二叉树

【TiDB】TiCDC canal_json的实际应用

ONEFLOW source code parsing: automatic inference of operator signature

Hospital online consultation applet source code Internet hospital source code smart hospital source code
随机推荐
Four tips tell you how to use SMS to promote business sales?
冰河老师的书
Dependencies tool to view exe and DLL dependencies
MySQL事务并发问题和MVCC机制
剑指 Offer 17. 打印从1到最大的n位数
Dlib库实现人脸关键点检测(Opencv实现)
英飞凌--GTM架构-Generic Timer Module
MRO industrial products procurement management system: enable MRO enterprise procurement nodes to build a new digital procurement system
Electronic components bidding and purchasing Mall: optimize traditional purchasing business and speed up enterprise digital upgrading
How to do a good job in software system demand research? Seven weapons make it easy for you to do it
C# Winform程序界面优化实例
挖财账号开户安全吗?是靠谱的吗?
Openlayers roller shutter map
countdownlatch 和 completableFuture 和 CyclicBarrier
C# Winform程序界面优化实例
TiDB Dashboard里面可以写sql执行吗
Volcano engine was selected into the first "panorama of edge computing industry" in China
「杂谈」对数据分析未来的几点思考
深度学习编译器的理解
How to solve the lock-in read-only alarm of AutoCAD Chinese language?