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)[source]#
Fuse convolutional module parameters and BatchNorm module parameters into new convolutional module parameters.
- Parameters
conv_w (torch.Tensor) โ Convolutional weight.
conv_b (Optional[torch.Tensor]) โ Convolutional bias.
bn_rm (torch.Tensor) โ BatchNorm running mean.
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) โ If True, transpose the conv weight. Defaults to False.
- Returns
Fused convolutional weight and bias.
- Return type
Tuple[torch.nn.Parameter, torch.nn.Parameter]