| 88 | |
| 89 | |
| 90 | class FactorizedReduce(nn.Module): |
| 91 | |
| 92 | def __init__(self, C_in, C_out, affine=True): |
| 93 | super(FactorizedReduce, self).__init__() |
| 94 | assert C_out % 2 == 0 |
| 95 | self.relu = nn.ReLU(inplace=False) |
| 96 | self.conv_1 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False) |
| 97 | self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False) |
| 98 | self.bn = nn.BatchNorm2d(C_out, affine=affine) |
| 99 | |
| 100 | def forward(self, x): |
| 101 | x = self.relu(x) |
| 102 | out = torch.cat([self.conv_1(x), self.conv_2(x[:,:,1:,1:])], dim=1) |
| 103 | out = self.bn(out) |
| 104 | return out |
| 105 |
no outgoing calls
no test coverage detected