Created
July 30, 2020 07:45
-
-
Save MLWhiz/927a1aeb70efe6c19f69ef42dd1e0e77 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Number of channels in the training images. For color images this is 3 | |
| nc = 3 | |
| # Size of feature maps in discriminator | |
| ndf = 64 | |
| 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