class composer.algorithms.BlurPool(replace_convs=True, replace_maxpools=True, blur_first=True, min_channels=16)[source]#

BlurPool adds anti-aliasing filters to convolutional layers.

This algorithm increases accuracy and invariance to small shifts in the input. It runs on Event.INIT.

  • replace_convs (bool) โ€“ replace strided torch.nn.Conv2d modules with BlurConv2d modules. Default: True.

  • replace_maxpools (bool) โ€“ replace eligible torch.nn.MaxPool2d modules with BlurMaxPool2d modules. Default: True.

  • blur_first (bool) โ€“ when replace_convs is True, blur input before the associated convolution. When set to False, the convolution is applied with a stride of 1 before the blurring, resulting in significant overhead (though more closely matching the paper). See BlurConv2d for further discussion. Default: True.

  • min_channels (int, optional) โ€“ Skip replacing layers with in_channels < min_channels. Commonly used to prevent the blurring of the first layer. Default: 16.