c5d6be170013db8975d96806084df573d87e5d26,implementations/gan/gan.py,,,#,82

Before Change


    datasets.MNIST("../../data/mnist", train=True, download=True,
                   transform=transforms.Compose([
                       transforms.ToTensor(),
                       transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
                   ])),
    batch_size=opt.batch_size, shuffle=True)

// Optimizers
optimizer_G = torch.optim.Adam(generator.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))
optimizer_D = torch.optim.Adam(discriminator.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))

Tensor = torch.cuda.FloatTensor if cuda else torch.FloatTensor

// ----------
//  Training
// ----------

for epoch in range(opt.n_epochs):
    for i, (imgs, _) in enumerate(dataloader):

        // Adversarial ground truths
        valid = Variable(Tensor(imgs.size(0), 1).fill_(1.0), requires_grad=False)
        fake = Variable(Tensor(imgs.size(0), 1).fill_(0.0), requires_grad=False)

        // Configure input

After Change


        train=True,
        download=True,
        transform=transforms.Compose(
            [transforms.Resize(opt.img_size), transforms.ToTensor(), transforms.Normalize([0.5], [0.5])]
        ),
    ),
    batch_size=opt.batch_size,
    shuffle=True,
)

// Optimizers
optimizer_G = torch.optim.Adam(generator.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))
optimizer_D = torch.optim.Adam(discriminator.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))

Tensor = torch.cuda.FloatTensor if cuda else torch.FloatTensor

// ----------
//  Training
// ----------

for epoch in range(opt.n_epochs):
    for i, (imgs, _) in enumerate(dataloader):

        // Adversarial ground truths
        valid = Variable(Tensor(imgs.size(0), 1).fill_(1.0), requires_grad=False)
        fake = Variable(Tensor(imgs.size(0), 1).fill_(0.0), requires_grad=False)

        // Configure input
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: c5d6be170013db8975d96806084df573d87e5d26
Time: 2019-03-28
Author: eriklindernoren@live.se
File Name: implementations/gan/gan.py
Class Name:
Method Name:


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: c5d6be170013db8975d96806084df573d87e5d26
Time: 2019-03-28
Author: eriklindernoren@live.se
File Name: implementations/softmax_gan/softmax_gan.py
Class Name:
Method Name:


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: c5d6be170013db8975d96806084df573d87e5d26
Time: 2019-03-28
Author: eriklindernoren@live.se
File Name: implementations/wgan_div/wgan_div.py
Class Name:
Method Name:


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: c5d6be170013db8975d96806084df573d87e5d26
Time: 2019-03-28
Author: eriklindernoren@live.se
File Name: implementations/wgan_gp/wgan_gp.py
Class Name:
Method Name: