当前位置:网站首页>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])
边栏推荐
- Deep learning compiler understanding
- Four tips tell you how to use SMS to promote business sales?
- Rust 文件系统处理之文件读写 - Rust 实践指南
- Geoffrey Hinton: my 50 years of in-depth study and Research on mental skills
- Another CVPR 2022 paper was accused of plagiarism, and Ping An insurance researchers sued IBM Zurich team
- How to solve the lock-in read-only alarm of AutoCAD Chinese language?
- 一点比较有意思的模块
- 服务器之间传文件夹,文件夹内容为空
- 充值满赠,IM+RTC+X 全通信服务「回馈季」开启
- Troubleshooting MySQL for update deadlock
猜你喜欢
医疗行业企业供应链系统解决方案:实现医疗数智化供应链协同可视
【TiDB】TiCDC canal_json的实际应用
Dlib库实现人脸关键点检测(Opencv实现)
Troubleshooting MySQL for update deadlock
What if icloud photos cannot be uploaded or synchronized?
Deep learning compiler understanding
又一篇CVPR 2022论文被指抄袭,平安保险研究者控诉IBM苏黎世团队
Coding officially entered Tencent conference application market!
电子元器件行业在线采购系统精准匹配采购需求,撬动电子产业数字化发展
EasyNVR平台设备通道均在线,操作出现“网络请求失败”是什么原因?
随机推荐
「经验」我对用户增长的理解『新用户篇』
Techo Youth2022学年高校公开课:直播连麦的背后,探索音视频技术如何应用
充值满赠,IM+RTC+X 全通信服务「回馈季」开启
php利用队列解决迷宫问题
OneFlow源码解析:算子签名的自动推断
小程序容器技术,促进园区运营效率提升
抖音最新Xbogus,signature生成js逆向分析
Geoffrey Hinton: my 50 years of in-depth study and Research on mental skills
Do you really understand the persistence mechanism of redis?
Is it safe to open a mobile stock account? Is it reliable?
Openlayers roller shutter map
Deep learning compiler understanding
Redis - persistent RDB and persistent AOF
Adhering to the concept of 'home in China', 2022 BMW children's traffic safety training camp was launched
深度学习编译器的理解
[cloud resident co creation] Huawei iconnect enables IOT terminals to connect at one touch
At present, the big guys are joining the two streams of flinksql, cdcmysql and Kafka, and the results are put into MySQL or KA
云安全日报220630:IBM数据保护平台发现执行任意代码漏洞,需要尽快升级
Sign up for Huawei cloud proposition in the "Internet +" competition, and you can take many gifts!
Solution of enterprise supply chain system in medical industry: realize collaborative visualization of medical digital intelligent supply chain