相关文章
Pytorch学习笔记(一):torch.cat()模块的详解
Pytorch学习笔记(二):nn.Conv2d()函数详解
Pytorch学习笔记(三):nn.BatchNorm2d()函数详解
Pytorch学习笔记(四):nn.MaxPool2d()函数详解
Pytorch学习笔记(五):nn.AdaptiveAvgPool2d()函数详解
Pytorch学习笔记(六):view()和nn.Linear()函数详解
Pytorch学习笔记(七):F.softmax()和F.log_softmax函数详解
文章目录
*
– 1.函数语法格式和作用
– 2.参数解释
– 3.具体代码
1.函数语法格式和作用
作用:
对邻域内特征点取最大
减小 卷积层参数误差造成估计 均值的偏移的误差,更多的保留纹理信息。
MaxPool2d(kernel_size, stride=None, padding=0,
dilation=1, return_indices=False, ceil_mode=False)
2.参数解释
- kernel_size(int or tuple) – max pooling的窗口大小
- stride(int or tuple, optional) – max pooling的窗口移动的步长。默认值是kernel_size
- padding(int or tuple, optional) – 输入的每一条边补充0的层数
- dilation(int or tuple, optional) – 一个控制窗口中元素步幅的参数
- return_indices – 如果等于True,会返回输出最大值的序号,对于上采样操作会有帮助
- ceil_mode – 如果等于True,计算输出信号大小的时候,会使用向上取整,代替默认的向下取整的操作
3.具体代码
>>>
>>> m = nn.MaxPool2d(3, stride=2)
>>>
>>> m = nn.MaxPool2d((3, 2), stride=(2, 1))
>>> input = autograd.Variable(torch.randn(20, 16, 50, 32))
>>> output = m(input)
Original: https://blog.csdn.net/m0_51004308/article/details/117959773
Author: ZZY_dl
Title: Pytorch学习笔记(四):nn.MaxPool2d()函数详解
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/651968/
转载文章受原作者版权保护。转载请注明原作者出处!