Pooling methods compatible with fastai & fastxtend's `xresnet`

BlurPool[source]

BlurPool(stride:int=2, ks:int=3, padding:int=0, ndim:int=2, ceil_mode:bool=False)

Compute blur (anti-aliasing) and downsample a given feature map.

Type Default Details
stride int 2 The stride size for pooling
ks int 3 The kernel size for pooling
padding int 0 Unused, for fastai compatibility
ndim int 2 Unused, for fastai compatibility
ceil_mode bool False Unused, for fastai compatibility

Stride and ks are reversed to match Average Pooling inputs in XResNet, where AveragePool2D(ks=2, stride=None) results in same output shape as BlurPool2D(ks=3, stride=2).

MaxBlurPool[source]

MaxBlurPool(stride:int=2, ks:int=3, padding:int=0, ndim:int=2, ceil_mode:int=True, max_ks:int=2)

Compute pools and blurs and downsample a given feature map. Equivalent to nn.Sequential(nn.MaxPool2d(...), BlurPool2D(...))

Type Default Details
stride int 2 The stride size for blur pooling
ks int 3 The kernel size for blur pooling
padding int 0 Unused, for fastai compatibility
ndim int 2 Unused, for fastai compatibility
ceil_mode int True If True, output size matches conv2d with same kernel size
max_ks int 2 The kernel size for max pooling

Stride and ks are reversed to match Average Pooling inputs in XResNet, where AveragePool2D(ks=2, stride=None) results in same output shape as MaxBlurPool2D(ks=3, stride=2).