What is the algorithm used for torch.nn.AdaptiveAvgPool2d?

I have read the documentation of torch.nn.AdaptiveAvgPool2d, and I understand how to use this function now. But I don’t get how this function works. Can help be provided to explain the algorithm of AdaptiveAvgPool2d?
Much appreciated.

@tom explains it beautifully in this post.

Could you tell me a paper which proposed adaptive poolings?

I’m not sure, if adaptive pooling was proposed in a scientific paper or if frameworks just implemented it to support variable sized inputs.

This is just speculation, but I think I came across adaptive pooling layers for the first time in the Network in Network paper. They use a global adaptive pooling and skip the linear layers at the end, argumenting that this might prevent overfitting to some degree.
PyTorch’s adaptive pooling layers are more flexible as you can set the output size yourself, instead of pooling globally over the whole spatial size.

1 Like


I couldn’t find any paper before and
I didn’t want to miss a paper if exists.

the idea of adaptive pooling is very similar to the novel idea proposed in SPP Net ( Spatial Pyramid Pooling )

1 Like