Last active
November 15, 2019 04:14
-
-
Save Exoceus/d3f360a8a465db10566525bafc283981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Discriminator(nn.Module): | |
def __init__(self, ngpu): | |
super(Discriminator, self).__init__() | |
self.ngpu = ngpu | |
self.main = nn.Sequential( | |
# input is (nc) x 64 x 64 | |
nn.Conv2d(nc, ndf, 4, 2, 1, bias=False), | |
nn.LeakyReLU(0.2, inplace=True), | |
# state size. (ndf) x 32 x 32 | |
nn.Conv2d(ndf, ndf * 2, 4, 2, 1, bias=False), | |
nn.BatchNorm2d(ndf * 2), | |
nn.LeakyReLU(0.2, inplace=True), | |
# state size. (ndf*2) x 16 x 16 | |
nn.Conv2d(ndf * 2, ndf * 4, 4, 2, 1, bias=False), | |
nn.BatchNorm2d(ndf * 4), | |
nn.LeakyReLU(0.2, inplace=True), | |
# state size. (ndf*4) x 8 x 8 | |
nn.Conv2d(ndf * 4, ndf * 8, 4, 2, 1, bias=False), | |
nn.BatchNorm2d(ndf * 8), | |
nn.LeakyReLU(0.2, inplace=True), | |
# state size. (ndf*8) x 4 x 4 | |
nn.Conv2d(ndf * 8, 1, 4, 1, 0, bias=False), | |
nn.Sigmoid() | |
) | |
def forward(self, input): | |
return self.main(input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment