mmcv.cnn.fuse_conv_bn¶
- mmcv.cnn.fuse_conv_bn(module: torch.nn.modules.module.Module) → torch.nn.modules.module.Module[source]¶
Recursively fuse conv and bn in a module.
During inference, the functionary of batch norm layers is turned off but only the mean and var alone channels are used, which exposes the chance to fuse it with the preceding conv layers to save computations and simplify network structures.
- Parameters
module (nn.Module) – Module to be fused.
- Returns
Fused module.
- Return type
nn.Module