composer.algorithms.functional.apply_blurpool

composer.algorithms.functional.apply_blurpool(model: torch.nn.modules.module.Module, replace_convs: bool = True, replace_maxpools: bool = True, blur_first: bool = True) None[source]

Add anti-aliasing filters to the strided torch.nn.Conv2d and/or torch.nn.MaxPool2d modules within model.

Must be run before the model has been moved to accelerators and before the model’s parameters have been passed to an optimizer.

Parameters
  • model – model to modify

  • replace_convs – replace strided torch.nn.Conv2d modules with BlurConv2d modules

  • replace_maxpools – replace eligible torch.nn.MaxPool2d modules with BlurMaxPool2d modules.

  • blur_first – for replace_convs, 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.