AdaptiveAvgPool2d Calculator
Calculate PyTorch AdaptiveAvgPool2d output shape. Specify target output size and input dimensions to see the pooling result. Commonly used before Linear layers.
Built by Michael Lip
Frequently Asked Questions
What does AdaptiveAvgPool2d do?
AdaptiveAvgPool2d automatically computes the kernel size, stride, and padding needed to produce an output of the specified spatial dimensions. You only specify the desired output size (e.g., (1,1) for global average pooling).
Why use AdaptiveAvgPool2d(1,1)?
AdaptiveAvgPool2d((1,1)) performs global average pooling, reducing each channel to a single value. This is used in ResNet and many modern architectures before the final Linear layer. It makes the network accept any input spatial size.
What is the output shape?
Output shape is (batch, channels, output_height, output_width). Batch and channel dimensions are unchanged. Only spatial dimensions are set to your specified output_size.
Difference from AvgPool2d?
AvgPool2d requires explicit kernel_size, stride, and padding. AdaptiveAvgPool2d only requires desired output size and computes pooling parameters automatically. Use Adaptive when you want resolution independence.
Is this tool free?
Yes. All HeyTensor tools are free, run in your browser, and require no signup.
About This Tool
Part of HeyTensor. All calculations run in your browser. Source code on GitHub.
Contact
Built by Michael Lip. Email [email protected].