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.Conv2dand/ortorch.nn.MaxPool2dmodules 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.Conv2dmodules withBlurConv2dmodulesreplace_maxpools – replace eligible
torch.nn.MaxPool2dmodules withBlurMaxPool2dmodules.blur_first – for
replace_convs, blur input before the associated convolution. When set toFalse, the convolution is applied with a stride of 1 before the blurring, resulting in significant overhead (though more closely matching the paper). SeeBlurConv2dfor further discussion.