当前位置:网站首页>Pytorch中的nn.AdaptiveAvgPool2d(output_size)简单介绍
Pytorch中的nn.AdaptiveAvgPool2d(output_size)简单介绍
2022-04-21 20:33:00 【研究生不迟到】
1 什么是池化?(Pooling)
- Pooling,池化层,又称下采样、汇聚层,是从样本中再选样本的过程。是为了缩减数据维度的操作。
- Pooling主要分两类:①最大池化(Max pooling)②均值池化(Avg pooling)
前者是取size×size中最大值。后者是采用平均值。
2 adaptivePooling和GeneralPooling
-
AdaptivePooling,自适应池化层。使用这种池化方式,核(kernal)和步长(stride)是函数根据输入的原始尺寸、目标尺寸自动计算出来的。
-
GeneralPooling,非自适应池化层,需要指定核的大小和步长。
3 代码调用
- 无需自己实现底层代码,可以直接调用
torch.nn.AdaptiveAvgPool2d(X)
- 非自适应方式的调用
# 最大池化
out = nn.MaxPool2d(kernel_size=2,stride=2)
# 均值池化
out = nn.AvgPool2d(kernel_size=2,stride=2)
- 自适应方式的调用
这里只需要指定output_size, 一个参数代表W和H相同,也可以自定义(H,W)
# 自适应最大池化
out=nn.AdaptiveAvgPool2d(output_size=100)
# 自适应均值池化
out=nn.AdaptiveMaxPool2d((10, 15))
版权声明
本文为[研究生不迟到]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_42521185/article/details/124322330
边栏推荐
- 再谈企业信息化的本质
- After three years of graduation, he achieved nothing and was forced to go back to his hometown. He made a decision to change his life.
- [transfer] SSE2 SSE introduction and C code example
- Tracup|使用项目管理软件帮助战胜拖延症
- 在两个TIA博途项目中组态PROFIBUS和PROFINET通信的具体方法
- Redis can send verification codes and limit the number of times sent every day
- He was in '98. I can't play with him
- 解决composer报错:Could not find a version of package xxx/yyy
- 824.山羊拉丁文
- How to let the back door of the network card kill a system and let you know how powerful the network card is
猜你喜欢

RTMP(3):Protocol Control Message

LeetCode_746 使用最小花费爬楼梯

人机验证reCAPTCHA v3使用完备说明

Jmeter如何设置参数化

ROS knowledge: how to realize camera access

C语言:简单的利润与奖金

After three years of graduation, he achieved nothing and was forced to go back to his hometown. He made a decision to change his life.

Im instant messaging development technology: 1-10 million high concurrency architecture evolution
![[network security] stapler1 of red team penetration project (Part 2)](/img/39/7d5594da6e7e89e510040b66eef383.png)
[network security] stapler1 of red team penetration project (Part 2)

How to ensure the stability and correctness of API? That's all you need
随机推荐
【网络安全】红队渗透项目之Stapler1(下)
There is a problem with CORS cross domain request
The timer class of version C is accurate to microseconds and retains one decimal place after seconds. It supports the output of year, month, day, hour, minute and second with units
On multi-core CPU, multithreading and parallel computing
php处理视频ffmpeg(转)
HW - new employee examination - traversal
IaaS,PaaS,SaaS 的区别
How to ensure the stability and correctness of API? That's all you need
La classe Timer de la version C # conserve une décimale pour supporter la sortie de l'unit é mm / JJ / MM / MIN / sec après avoir été exacte à microsecondes
如何确保API 的稳定性与正确性?你只需要这一招
Oracle data import notes
My medical experience of "traditional Chinese medicine"
Mysql 基础命令大全
The difference between English and American pronunciation [turn]
实战 | 基于JMeter 完成典型电商场景(首页浏览)的性能压测
【合泰ht32与stm32进行串口通信点灯】
warning: LF will be replaced by CRLF in composer.json.
Actual combat | performance pressure test of JMeter typical e-commerce scenario (order / payment)
Why do you have no idea when doing data analysis?
Pfsense configuring IPSec site to site tunneling using certificate authentication Guide