torch.nn.utils.fuse_linear_bn_eval¶
- 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
linearandbnmust be in eval mode, andbnmust have its running buffers computed.