当前位置:网站首页>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])
边栏推荐
- One script of unity actual combat realizes radar chart
- 秉持'家在中国'理念 2022 BMW儿童交通安全训练营启动
- Vscode status bar statusbar
- Compilation problems and solutions of teamtalk winclient
- TiDB Dashboard里面可以写sql执行吗
- Openlayers roller shutter map
- AI首席架构师10-AICA-蓝翔 《飞桨框架设计与核心技术》
- Vulnerability recurrence ----37. Apache unomi Remote Code Execution Vulnerability (cve-2020-13942)
- 「经验」我对用户增长的理解『新用户篇』
- Rust 文件系统处理之文件读写 - Rust 实践指南
猜你喜欢

深度学习编译器的理解

电子元器件招标采购商城:优化传统采购业务,提速企业数字化升级
![[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform](/img/56/9f3370eac60df182971607aa642dc2.jpg)
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform

autocad中文语言锁定只读警报怎么解决?

挑选智能音箱时,首选“智能”还是“音质”?这篇文章给你答案

程序员女友给我做了一个疲劳驾驶检测

助力极致体验,火山引擎边缘计算最佳实践

亲测flutter打包apk后大小,比较满意

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

Countdowncatch and completabilefuture and cyclicbarrier
随机推荐
剑指 Offer 17. 打印从1到最大的n位数
Tide - 基于 async-std 的 Rust-web 框架
Research on the principle of Tencent persistence framework mmkv
Is it safe to open a mobile stock account? Is it reliable?
C WinForm program interface optimization example
删除排序链表中的重复元素 II[链表节点统一操作--dummyHead]
In distributed scenarios, do you know how to generate unique IDs?
MySQL找不到mysql.sock文件的臨時解
How to solve the lock-in read-only alarm of AutoCAD Chinese language?
ForkJoinPool
How to use AI technology to optimize the independent station customer service system? Listen to the experts!
详解单例模式
大佬们目前flinksql, cdcmysql跟Kafka双流join,结果放到mysql 或者ka
Development and construction of NFT mining tour gamefi chain tour system
《Go题库·15》go struct 能不能比较?
Vulnerability recurrence ----37. Apache unomi Remote Code Execution Vulnerability (cve-2020-13942)
Digital intelligent supplier management system solution for coal industry: data driven, supplier intelligent platform helps enterprises reduce costs and increase efficiency
充值满赠,IM+RTC+X 全通信服务「回馈季」开启
The easynvr platform equipment channels are all online. What is the reason for the "network request failure" in the operation?
《所谓情商高,就是会说话》读书笔记