From 0c7af1a4d293b40de08613468369e2f5d9b143fa Mon Sep 17 00:00:00 2001 From: LinCoce <328655009@qq.com> Date: Fri, 31 Jan 2020 13:58:26 +0800 Subject: [PATCH] fusedconv bug fix, https://github.com/ultralytics/yolov3/issues/807 (#818) Looks good. Thanks for catching the bug @LinCoce! --- utils/torch_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/torch_utils.py b/utils/torch_utils.py index d615e2a8..9b321724 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -61,7 +61,7 @@ def fuse_conv_and_bn(conv, bn): else: b_conv = torch.zeros(conv.weight.size(0)) b_bn = bn.bias - bn.weight.mul(bn.running_mean).div(torch.sqrt(bn.running_var + bn.eps)) - fusedconv.bias.copy_(b_conv + b_bn) + fusedconv.bias.copy_(torch.mm(w_bn, b_conv.reshape(-1, 1)).reshape(-1) + b_bn) return fusedconv