fusedconv bug fix, https://github.com/ultralytics/yolov3/issues/807 (#818)
Looks good. Thanks for catching the bug @LinCoce!
This commit is contained in:
parent
6f769081d1
commit
0c7af1a4d2
|
@ -61,7 +61,7 @@ def fuse_conv_and_bn(conv, bn):
|
||||||
else:
|
else:
|
||||||
b_conv = torch.zeros(conv.weight.size(0))
|
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))
|
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
|
return fusedconv
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue