a4697d7e45e66a3264eb56dcf489d67d4df40d23,implementations/cgan/cgan.py,Discriminator,__init__,#Discriminator#,74

Before Change



        layers = []
        in_filters = opt.channels + 1
        for out_filters, bn in [(16, False), (32, True), (64, True), (128, False)]:
            layers.extend(discriminator_block(in_filters, out_filters, bn))
            in_filters = out_filters

        self.model = nn.Sequential(*layers)

        // The height and width of downsampled image
        ds_size = opt.img_size // 2**4

After Change


    def __init__(self):
        super(Discriminator, self).__init__()

        self.label_embedding = nn.Embedding(opt.n_classes, opt.n_classes)

        self.model = nn.Sequential(
            nn.Linear(opt.n_classes + opt.img_size**2, 512),
            nn.LeakyReLU(0.2, inplace=True),
            nn.Linear(512, 512),
            nn.Dropout(0.4),
            nn.LeakyReLU(0.2, inplace=True),
            nn.Linear(512, 512),
            nn.Dropout(0.4),
            nn.LeakyReLU(0.2, inplace=True),
            nn.Linear(512, 1),
            nn.Sigmoid()
        )

    def forward(self, img, labels):
        // Concatenate label embedding and image by channels
        d_input = torch.cat((img.view(img.size(0), -1), self.label_embedding(labels)), -1)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: a4697d7e45e66a3264eb56dcf489d67d4df40d23
Time: 2018-04-23
Author: eriklindernoren@gmail.com
File Name: implementations/cgan/cgan.py
Class Name: Discriminator
Method Name: __init__


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 570cd4f66bdf9c3e4b4bb8fbc31fa24b0bd7cdbd
Time: 2018-04-22
Author: eriklindernoren@live.se
File Name: implementations/gan/gan.py
Class Name: Generator
Method Name: __init__


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: a4697d7e45e66a3264eb56dcf489d67d4df40d23
Time: 2018-04-23
Author: eriklindernoren@gmail.com
File Name: implementations/cgan/cgan.py
Class Name: Discriminator
Method Name: __init__


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 570cd4f66bdf9c3e4b4bb8fbc31fa24b0bd7cdbd
Time: 2018-04-22
Author: eriklindernoren@live.se
File Name: implementations/wgan/wgan.py
Class Name: Generator
Method Name: __init__