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