Defines a PatchGAN discriminator
| 1401 | |
| 1402 | |
| 1403 | class PatchDiscriminator(NLayerDiscriminator): |
| 1404 | """Defines a PatchGAN discriminator""" |
| 1405 | |
| 1406 | def __init__(self, input_nc, ndf=64, n_layers=3, norm_layer=nn.BatchNorm2d, no_antialias=False): |
| 1407 | super().__init__(input_nc, ndf, 2, norm_layer, no_antialias) |
| 1408 | |
| 1409 | def forward(self, input): |
| 1410 | B, C, H, W = input.size(0), input.size(1), input.size(2), input.size(3) |
| 1411 | size = 16 |
| 1412 | Y = H // size |
| 1413 | X = W // size |
| 1414 | input = input.view(B, C, Y, size, X, size) |
| 1415 | input = input.permute(0, 2, 4, 1, 3, 5).contiguous().view(B * Y * X, C, size, size) |
| 1416 | return super().forward(input) |
| 1417 | |
| 1418 | |
| 1419 | class GroupedChannelNorm(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected