MCPcopy Create free account
hub / github.com/JunlinHan/DCLGAN / PatchDiscriminator

Class PatchDiscriminator

models/networks.py:1403–1416  ·  view source on GitHub ↗

Defines a PatchGAN discriminator

Source from the content-addressed store, hash-verified

1401
1402
1403class 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
1419class GroupedChannelNorm(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected