当前位置:网站首页>Pytorch nn. functional. Simple understanding and usage of unfold()
Pytorch nn. functional. Simple understanding and usage of unfold()
2022-07-01 22:47:00 【zouxiaolv】
import torch
from torch.nn import functional as F
x =torch.arange(36).view(1,2,2,9).float()
print('x',x)
x = F.unfold(x, (2, 2))
print('x1',x)
print(x.size())
x tensor([[[[ 0., 1., 2., 3., 4., 5., 6., 7., 8.],
[ 9., 10., 11., 12., 13., 14., 15., 16., 17.]],
[[18., 19., 20., 21., 22., 23., 24., 25., 26.],
[27., 28., 29., 30., 31., 32., 33., 34., 35.]]]])
x1 tensor([[[ 0., 1., 2., 3., 4., 5., 6., 7.],
[ 1., 2., 3., 4., 5., 6., 7., 8.],
[ 9., 10., 11., 12., 13., 14., 15., 16.],
[10., 11., 12., 13., 14., 15., 16., 17.],
[18., 19., 20., 21., 22., 23., 24., 25.],
[19., 20., 21., 22., 23., 24., 25., 26.],
[27., 28., 29., 30., 31., 32., 33., 34.],
[28., 29., 30., 31., 32., 33., 34., 35.]]])
torch.Size([1, 8, 8])
The sliding window is 2*2
Then the range of sliding input is 2*2, For example, the first one is
[0., 1.,
9., 10.]
The output is flattened into
[0.,
1.,
9.,
10.]
In turn, it becomes the above output form
边栏推荐
- 13th Blue Bridge Cup group B national tournament
- 【QT小作】封装一个简单的线程管理类
- rxjs Observable of 操作符的单步调试分析
- 牛客月赛-分组求对数和
- 搜狗微信APP逆向(二)so层
- MySQL MHA high availability configuration and failover
- Why must digital transformation strategies include continuous testing?
- Clean up system cache and free memory under Linux
- 台积电全球员工薪酬中位数约46万,CEO约899万;苹果上调日本的 iPhone 售价 ;Vim 9.0 发布|极客头条
- [ecological partner] Kunpeng system engineer training
猜你喜欢
[jetcache] how to use jetcache
447-哔哩哔哩面经1
Chen Tianqi's machine learning compilation course (free)
配置筛选机
3DE resources have nothing or nothing wrong
SAP 智能机器人流程自动化(iRPA)解决方案分享
# CutefishOS系统~
YOLOv5.5 调用本地摄像头
Selection of all-optical technology in the park - Part 2
CIO's discussion and Analysis on the definition of high-performance it team
随机推荐
JVM有哪些类加载机制?
Mixconv code
H5 model trained by keras to tflite
Gaussdb (DWS) active prevention and troubleshooting
三翼鸟两周年:羽翼渐丰,腾飞指日可待
Chen Tianqi's machine learning compilation course (free)
【目标跟踪】|单目标跟踪指标
Learn MySQL from scratch - database and data table operations
黑马程序员-软件测试--06阶段2-linux和数据库-01-08第一章-linux操作系统阶段内容说明,linux命令基本格式以及常见形式的说明,操作系统的常见的分类,查看命令帮助信息方法,
配置筛选机
【c语言】malloc函数详解[通俗易懂]
Yolov5.5 call local camera
【QT小作】封装一个简单的线程管理类
Object memory layout
MySQL5.7 设置密码策略(等保三级密码改造)
旅游管理系统
leetcode - 287. 寻找重复数
Recent public ancestor (LCA) online practices
Sonic cloud real machine learning summary 6 - 1.4.1 server and agent deployment
多图预警~ 华为 ECS 与 阿里云 ECS 对比实战