3f62a3f23930c17170dc2e03f0de56da83f8ec80,implementations/unit/unit.py,,,#,152
Before Change
// Fake loss
loss_fake = criterion_GAN(D1(fake_X1.detach()), fake)
// Total loss
loss_D1 = (loss_real + loss_fake) / 2
loss_D1.backward()
optimizer_D1.step()
// -----------------------
// Train Discriminator B
// -----------------------
optimizer_D2.zero_grad()
// Real loss
loss_real = criterion_GAN(D2(X2), valid)
// Fake loss
loss_fake = criterion_GAN(D2(fake_X2.detach()), fake)
// Total loss
loss_D2 = (loss_real + loss_fake) / 2
loss_D2.backward()
optimizer_D2.step()
loss_D = (loss_D1 + loss_D2) / 2
// --------------
// Log Progress
// --------------
After Change
optimizer_D2.zero_grad()
loss_D2 = criterion_GAN(D2(X2), valid) + \
criterion_GAN(D2(fake_X2.detach()), fake)
loss_D2.backward()
optimizer_D2.step()
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 10
Instances
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 3f62a3f23930c17170dc2e03f0de56da83f8ec80
Time: 2018-05-24
Author: eriklindernoren@gmail.com
File Name: implementations/unit/unit.py
Class Name:
Method Name: