Looks good. Thanks for catching the bug @LinCoce!
This commit is contained in:
LinCoce 2020-01-31 13:58:26 +08:00 committed by GitHub
parent 6f769081d1
commit 0c7af1a4d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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