| 69 | |
| 70 | # This is designed to insert BNStat layer between Conv2d(without bias) and its bias |
| 71 | class 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 | |
| 78 | def switch_repvggblock_to_bnstat(model): |
| 79 | for n, block in model.named_modules(): |
no outgoing calls
no test coverage detected