torch.nn.utils.fusion.fuse_linear_bn_eval#
- torch.nn.utils.fusion.fuse_linear_bn_eval(linear, bn)[原始碼]#
將線性模組和 BatchNorm 模組融合為一個新的線性模組。
- 引數
linear (torch.nn.Linear) – 一個 Linear 模組。
bn (torch.nn.modules.batchnorm._BatchNorm) – BatchNorm 模組。
- 返回
融合後的線性模組。
- 返回型別
注意
linear和bn都必須處於 eval 模式,並且bn必須已經計算了其 running buffers。