Skip to content

Instantly share code, notes, and snippets.

@udithhaputhanthri
Created March 26, 2021 08:24
Show Gist options
  • Save udithhaputhanthri/50a6f1edd5e93be399e5636e99124fa9 to your computer and use it in GitHub Desktop.
Save udithhaputhanthri/50a6f1edd5e93be399e5636e99124fa9 to your computer and use it in GitHub Desktop.
WGAN_scripts
def get_gen_loss(crit_fake_pred):
gen_loss= -torch.mean(crit_fake_pred)
return gen_loss
def get_crit_loss(crit_fake_pred, crit_real_pred, gradient_penalty, c_lambda):
crit_loss= torch.mean(crit_fake_pred)- torch.mean(crit_real_pred)+ c_lambda* gradient_penalty
return crit_loss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment