MCPcopy Create free account
hub / github.com/VisionRush/DeepFakeDefenders / fuse_bn

Function fuse_bn

model/replknet.py:65–74  ·  view source on GitHub ↗
(conv, bn)

Source from the content-addressed store, hash-verified

63 return result
64
65def fuse_bn(conv, bn):
66 kernel = conv.weight
67 running_mean = bn.running_mean
68 running_var = bn.running_var
69 gamma = bn.weight
70 beta = bn.bias
71 eps = bn.eps
72 std = (running_var + eps).sqrt()
73 t = (gamma / std).reshape(-1, 1, 1, 1)
74 return kernel * t, beta - running_mean * gamma / std
75
76class ReparamLargeKernelConv(nn.Module):
77

Callers 2

deep_fuse_BNMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected