Skip to content

Instantly share code, notes, and snippets.

@pythonlessons
Created May 30, 2023 08:45
Show Gist options
  • Select an option

  • Save pythonlessons/5d1719738ef20d5c37475955745a218c to your computer and use it in GitHub Desktop.

Select an option

Save pythonlessons/5d1719738ef20d5c37475955745a218c to your computer and use it in GitHub Desktop.
wgan_gp
# 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