MCPcopy Create free account
hub / github.com/DingXiaoH/RepVGG / BiasAdd

Class BiasAdd

tools/insert_bn.py:71–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70# This is designed to insert BNStat layer between Conv2d(without bias) and its bias
71class BiasAdd(nn.Module):
72 def __init__(self, num_features):
73 super(BiasAdd, self).__init__()
74 self.bias = torch.nn.Parameter(torch.Tensor(num_features))
75 def forward(self, x):
76 return x + self.bias.view(1, -1, 1, 1)
77
78def switch_repvggblock_to_bnstat(model):
79 for n, block in model.named_modules():

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected