【pytorch】torch.nn.AdaptiveMaxPool2d 自适应池化

本文详细解析了PyTorch中的torch.nn.AdaptiveMaxPool2d模块,探讨了如何使用该模块进行自适应最大池化操作。内容涵盖output_size参数的设置方式,以及return_indices选项在配合nn.MaxUnpool2d时的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://pytorch.org/docs/master/generated/torch.nn.AdaptiveMaxPool2d.html#torch.nn.AdaptiveMaxPool2d

 

torch.nn.AdaptiveMaxPool2d

  • output_size – the target output size of the image of the form H x W. Can be a tuple (H, W) or a single H for a square image H x H. H and W can be either a int, or None which means the size will be the same as that of the input.

  • return_indices – if True, will return the indices along with the outputs. Useful to pass to nn.MaxUnpool2d. Default: False

GAP的优势在于:

各个类别于Feature Map 之间的联系更加直观(相比与全连接层的黑箱来说),Feature Map 被转化为分类概率也更加容易,因为在GAP中没有参数需要调,所以避免了过拟合的问题。

GAP汇总了空间信息

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值