Created
May 30, 2023 08:45
-
-
Save pythonlessons/5d1719738ef20d5c37475955745a218c to your computer and use it in GitHub Desktop.
wgan_gp
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
| # Wasserstein loss for the discriminator | |
| def discriminator_w_loss(pred_real, pred_fake): | |
| real_loss = tf.reduce_mean(pred_real) | |
| fake_loss = tf.reduce_mean(pred_fake) | |
| return fake_loss - real_loss | |
| # Wasserstein loss for the generator | |
| def generator_w_loss(pred_fake): | |
| return -tf.reduce_mean(pred_fake) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment