首页 > 其他 > 详细

PyTorch——池化(一)

时间:2021-03-17 15:29:56      阅读:41      评论:0      收藏:0      [点我收藏+]
torch.nn.MaxPool2d(kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False)

Parameters

1 kernel_size – the size of the window to take a max over
2 stride – the stride of the window. Default value is kernel_size
3 padding – implicit zero padding to be added on both sides
4 dilation – a parameter that controls the stride of elements in the window
5 return_indices – if True, will return the max indices along with the outputs. Useful for torch.nn.MaxUnpool2d later
6 ceil_mode – when True, will use ceil instead of floor to compute the output shape

Shape

技术分享图片

Examples

[32, 64, 112, 112] ——> [32, 64, 56, 56] 

1 import torch
2 import torch.nn as nn
3 
4 pool1 = nn.MaxPool2d(2, stride=2)
5 print(pool1(input1).size())

[32, 64, 112, 112] ——> [32, 64, 111, 111]

1 import torch
2 import torch.nn as nn
3 
4 pool1 = nn.MaxPool2d(2, stride=1)
5 print(pool1(input1).size())

 

PyTorch——池化(一)

原文:https://www.cnblogs.com/timelesszxl/p/14549183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!