当前位置:网站首页>Pytorch nn.functional.unfold()的简单理解与用法
Pytorch nn.functional.unfold()的简单理解与用法
2022-07-01 21:50: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])
滑动窗口是2*2
然后滑动输入的范围是2*2,比如滑动第一个是
[0., 1.,
9., 10.]
输出是拉平变成
[0.,
1.,
9.,
10.]
依次就变成以上的输出形式
边栏推荐
- Slope compensation
- 好友新书发布,祝贺(送福利)
- 【日常训练】326. 3 的幂
- In the past 100 years, only 6 products have been approved, which is the "adjuvant" behind the vaccine competition
- 小红书Scheme跳转到指定页面
- C#/VB.NET 给PDF文档添加文本/图像水印
- Two schemes of transforming the heat map of human posture estimation into coordinate points
- Pytorch's code for visualizing feature maps after training its own network
- Operation category read is not supported in state standby
- 倒置残差的理解
猜你喜欢
随机推荐
多图预警~ 华为 ECS 与 阿里云 ECS 对比实战
【日常训练】326. 3 的幂
Clean up system cache and free memory under Linux
性能测试计划怎么编写
rxjs Observable of 操作符的单步调试分析
【c语言】malloc函数详解[通俗易懂]
Ffmpeg learning notes
The fixed assets management subsystem reports are divided into what categories and which accounts are included
Ida dynamic debugging apk
MySQL MHA high availability configuration and failover
13th Blue Bridge Cup group B national tournament
友善串口助手使用教程_友善串口调试助手怎么进行配置-友善串口调试助手使用教程…
Relationship and difference between enterprise architecture and project management
Configure filter
对象内存布局
高攀不起的希尔排序,直接插入排序
三翼鸟两周年:羽翼渐丰,腾飞指日可待
小红书Scheme跳转到指定页面
nn. Parameter] pytoch feature fusion adaptive weight setting (learnable weight use)
YOLOv5.5 调用本地摄像头