当前位置:网站首页>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
边栏推荐
- Operation category read is not supported in state standby
- Learning notes on futuretask source code of concurrent programming series
- Explain kubernetes network model in detail
- Pytorch's code for visualizing feature maps after training its own network
- cvpr2022 human pose estiamtion
- 利用SecureCRTPortable远程连接虚拟机
- Relationship and difference between enterprise architecture and project management
- 配置筛选机
- In the past 100 years, only 6 products have been approved, which is the "adjuvant" behind the vaccine competition
- Clean up system cache and free memory under Linux
猜你喜欢
随机推荐
Sonic cloud real machine learning summary 6 - 1.4.1 server and agent deployment
GenICam GenTL 标准 ver1.5(4)第五章 采集引擎
MySQL的存储过程
元宇宙可能成为互联网发展的新方向
Appium自动化测试基础 — APPium安装(一)
cvpr2022 human pose estiamtion
搜狗微信APP逆向(二)so层
Ida dynamic debugging apk
MySQL的视图练习题
Configure filter
分享一个一年经历两次裁员的程序员的一些感触
黑马程序员-软件测试--06阶段2-linux和数据库-01-08第一章-linux操作系统阶段内容说明,linux命令基本格式以及常见形式的说明,操作系统的常见的分类,查看命令帮助信息方法,
聊一聊Zabbix都监控哪些参数
Compensation des créneaux horaires
Tourism Management System
完全注解的ssm框架搭建
QT 使用FFmpeg4将argb的Qimage转换成YUV422P
[untitled]
【c语言】malloc函数详解[通俗易懂]
Awoo's favorite problem (priority queue)