torch.nn.utils.fuse_linear_bn_eval — PyTorch 2.7 documentation (original) (raw)
Shortcuts
torch.nn.utils.fuse_linear_bn_eval(linear, bn)[source][source]¶
Fuse a linear module and a BatchNorm module into a single, new linear module.
Parameters
- linear (torch.nn.Linear) – A Linear module.
- bn (torch.nn.modules.batchnorm._BatchNorm) – A BatchNorm module.
Returns
The fused linear module.
Return type
Note
Both linear
and bn
must be in eval mode, and bn
must have its running buffers computed.
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.