(self, input_nc, output_nc, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False)
| 309 | |
| 310 | class DownBlock2d(nn.Module): |
| 311 | def __init__(self, input_nc, output_nc, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False): |
| 312 | super(DownBlock2d, self).__init__() |
| 313 | |
| 314 | kwargs = {'kernel_size': 3, 'stride': 1, 'padding': 1} |
| 315 | conv = spectral_norm(nn.Conv2d(input_nc, output_nc, **kwargs), use_spect) |
| 316 | pool = nn.AvgPool2d(kernel_size=(2, 2)) |
| 317 | |
| 318 | if type(norm_layer) == type(None): |
| 319 | self.model = nn.Sequential(conv, nonlinearity, pool) |
| 320 | else: |
| 321 | self.model = nn.Sequential(conv, norm_layer(output_nc), nonlinearity, pool) |
| 322 | |
| 323 | def forward(self, x): |
| 324 | out = self.model(x) |
nothing calls this directly
no test coverage detected