当前位置:网站首页>torch stack() meshgrid()
torch stack() meshgrid()
2022-06-30 19:06:00 【Gy Zhao】
x= torch.arange(4)
y= torch.arange(4)
# Input is a one-dimensional sequence , Output two 2D meshes , Commonly used to generate coordinates
ox,oy = torch.meshgrid([x,y])
# Splice according to a certain dimension , Input sequence shape It has to be consistent , The default in accordance with the 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]])
amount to (0,0)(0,1)… Two pairs of elements with the same position of two-dimensional tensors are one coordinate
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])
边栏推荐
- [零基础学IoT Pwn] 环境搭建
- countdownlatch 和 completableFuture 和 CyclicBarrier
- 详解单例模式
- System integration project management engineer certification high frequency examination site: prepare project scope management plan
- Compilation problems and solutions of teamtalk winclient
- Coding officially entered Tencent conference application market!
- The online procurement system of the electronic components industry accurately matches the procurement demand and leverages the digital development of the electronic industry
- Geoffrey Hinton: my 50 years of in-depth study and Research on mental skills
- [community star selection] the 23rd issue of the July revision plan | bit by bit creation, converging into a tower! Huawei freebuses 4E and other cool gifts
- How to do a good job in software system demand research? Seven weapons make it easy for you to do it
猜你喜欢

Redis入门到精通01

不同制造工艺对PCB上的焊盘的影响和要求
Do you really understand the persistence mechanism of redis?

煤炭行业数智化供应商管理系统解决方案:数据驱动,供应商智慧平台助力企业降本增效

医疗行业企业供应链系统解决方案:实现医疗数智化供应链协同可视

《所谓情商高,就是会说话》读书笔记

全栈代码测试覆盖率及用例发现系统的建设和实践

教你30分钟快速搭建直播间

Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 1)

Lenovo Yoga 27 2022, full upgrade of super configuration
随机推荐
电子元器件招标采购商城:优化传统采购业务,提速企业数字化升级
如何利用AI技术优化独立站客服系统?听听专家怎么说!
《客从何处来》
PHP uses queues to solve maze problems
Deep learning compiler understanding
联想YOGA 27 2022,超强配置全面升级
Large file transfer software based on UDP protocol
rust配置国内源
Word——Word在试图打开文件时遇到错误的一种解决办法
教你30分钟快速搭建直播间
Solution of enterprise supply chain system in medical industry: realize collaborative visualization of medical digital intelligent supply chain
挑选智能音箱时,首选“智能”还是“音质”?这篇文章给你答案
Entry node of link in linked list - linked list topic
【TiDB】TiCDC canal_json的实际应用
煤炭行业数智化供应商管理系统解决方案:数据驱动,供应商智慧平台助力企业降本增效
Sword finger offer 17 Print from 1 to maximum n digits
The cloud native landing practice of using rainbow for Tuowei information
MRO industrial products procurement management system: enable MRO enterprise procurement nodes to build a new digital procurement system
opencv数据类型代码表 dtype
新版EasyGBS如何配置WebRTC视频流格式播放?