Padded 2D Pooling #
Symmetric-padding variants of the 2D pooling specs and their backward maps.
Padded pooling (symmetric padding) #
For max-pooling, padded locations are not real input elements and are ignored when selecting the
maximum. This is the scalar-polymorphic way to model PyTorch's -∞ max-pool padding without adding
a backend-specific infinity constant to Context α.
For average pooling, this corresponds to including padded zeros in the average (PyTorch's default
count_include_pad = true).
Remove symmetric zero-padding from a multi-channel image (channel-wise unpad_image).
Instances For
Multi-channel max-pooling forward pass with PyTorch-style padding (-∞ outside bounds).
Instances For
Forward-mode JVP for padded hard max-pooling.
Padding cells are ignored exactly as in maxPool2dMultiSpecPad, so the tangent is taken from the
primal winner among real input locations only. If a window contains no real input cells, the
forward value and tangent are both 0.
Instances For
Multi-channel average pooling forward pass with symmetric zero padding.
Instances For
Multi-channel max-pooling backward pass with PyTorch-style padding (-∞ outside bounds).
Instances For
Multi-channel average-pooling backward pass with symmetric padding (backprop then unpad).
Instances For
Backward/VJP for smooth_max_pool2d_spec (log-sum-exp surrogate).
Instances For
Multi-channel backward for smooth_max_pool2d_multi_spec (apply per channel).