View Code? Open in Web Editor
NEW
Source code for "Towards a Deeper Understanding of Adversarial Losses under a Discriminative Adversarial Network Setting"
Home Page: https://salu133445.github.io/dan/
License: MIT License
Shell 6.71%
Python 93.29%
dan's People
Contributors
dan's Issues
def minimax_hinge_gan_losses(discriminator_real_outputs,
discriminator_fake_outputs):
"""Return the minimax hinge GAN losses for the generator and the
discriminator.
(Generator) -max(0, 1 + D(G(z)))
(Discriminator) max(0, 1 - D(x)) + max(0, 1 + D(G(z)))
"""
discriminator_loss = (
tf.reduce_mean(tf.nn.relu(1. - discriminator_real_outputs))
+ tf.reduce_mean(tf.nn.relu(1. + discriminator_fake_outputs)))
generator_loss = -discriminator_loss
return generator_loss, discriminator_loss
the note is not the same as the code in the function, Can you give an explanation? Thanks.