torch.nn.utils.fuse_conv_bn_eval¶
- torch.nn.utils.fuse_conv_bn_eval(conv, bn, transpose=False)[原始碼][原始碼]¶
將卷積模組和 BatchNorm 模組融合到一個新的卷積模組中。
- 參數
conv (torch.nn.modules.conv._ConvNd) – 一個卷積模組。
bn (torch.nn.modules.batchnorm._BatchNorm) – 一個 BatchNorm 模組。
transpose (bool, optional) – 如果為 True,則轉置卷積權重。預設為 False。
- 傳回
融合的卷積模組。
- 傳回類型
torch.nn.modules.conv._ConvNd
注意
conv
和bn
都必須處於 eval 模式,並且bn
必須已計算其 running buffers。