捷徑

torch.nn.utils.fuse_conv_bn_weights

torch.nn.utils.fuse_conv_bn_weights(conv_w, conv_b, bn_rm, bn_rv, bn_eps, bn_w, bn_b, transpose=False)[來源][來源]

將卷積模組參數和 BatchNorm 模組參數融合到新的卷積模組參數中。

參數
  • conv_w (torch.Tensor) – 卷積權重。

  • conv_b (Optional[torch.Tensor]) – 卷積偏差。

  • bn_rm (torch.Tensor) – BatchNorm 執行平均值。

  • bn_rv ( torch.Tensor ) – BatchNorm 執行變異數 (running variance)。

  • bn_eps ( float ) – BatchNorm epsilon。

  • bn_w (Optional[torch.Tensor]) – BatchNorm 權重 (weight)。

  • bn_b (Optional[torch.Tensor]) – BatchNorm 偏置 (bias)。

  • transpose ( bool, optional ) – 如果為 True,則轉置卷積權重。預設為 False。

回傳:

融合後的卷積權重和偏置。

回傳類型:

Tuple[torch.nn.Parameter, torch.nn.Parameter]

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources