| 282 | return out |
| 283 | |
| 284 | class UpBlock2d(nn.Module): |
| 285 | def __init__(self, input_nc, output_nc, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False): |
| 286 | super(UpBlock2d, self).__init__() |
| 287 | kwargs = {'kernel_size': 3, 'stride': 1, 'padding': 1} |
| 288 | conv = spectral_norm(nn.Conv2d(input_nc, output_nc, **kwargs), use_spect) |
| 289 | if type(norm_layer) == type(None): |
| 290 | self.model = nn.Sequential(conv, nonlinearity) |
| 291 | else: |
| 292 | self.model = nn.Sequential(conv, norm_layer(output_nc), nonlinearity) |
| 293 | |
| 294 | def forward(self, x): |
| 295 | out = self.model(F.interpolate(x, scale_factor=2)) |
| 296 | return out |
| 297 | |
| 298 | class FineADAINResBlocks(nn.Module): |
| 299 | def __init__(self, num_block, input_nc, feature_nc, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False): |