快捷方式

torch.nn.utils.fuse_linear_bn_eval

torch.nn.utils.fuse_linear_bn_eval(linear, bn)[原始碼][原始碼]

將一個線性模組 (linear module) 和一個 BatchNorm 模組融合成一個新的線性模組。

引數
  • linear (torch.nn.Linear) – 一個線性模組。

  • bn (torch.nn.modules.batchnorm._BatchNorm) – 一個 BatchNorm 模組。

返回值

融合後的線性模組。

返回型別

torch.nn.Linear

注意

linearbn 都必須處於評估模式 (eval mode),並且 bn 的執行緩衝區 (running buffers) 必須已計算。

文件

查閱 PyTorch 全面的開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並解答您的疑問

檢視資源