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/ortorch.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 withBlurConv2d
modulesreplace_maxpools – replace eligible
torch.nn.MaxPool2d
modules withBlurMaxPool2d
modules.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). SeeBlurConv2d
for further discussion.