Skip to content
Snippets Groups Projects
Commit 9e1e6e5f authored by Andreas Hartmann's avatar Andreas Hartmann
Browse files

Added Wasserstein loss

parent 3cd9fd1d
No related branches found
No related tags found
No related merge requests found
import tensorflow as tf
def wgan_d_loss(y_true, y_pred, EPS=1e-12):
return tf.reduce_mean(y_pred) - tf.reduce_mean(y_true)
def wgan_g_loss(y_true, y_pred, EPS=1e-12):
return tf.reduce_mean(y_pred + EPS)
def gan_d_loss(y_true, y_pred, EPS=1e-12):
return tf.reduce_mean(tf.math.log(y_true + EPS) + tf.math.log(1 - y_pred + EPS))
def gan_g_loss(y_true, y_pred, EPS=1e-12):
return tf.reduce_mean(-tf.math.log(y_pred + EPS))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment