Skip to content
Snippets Groups Projects
Commit 5d941f52 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 964e3031
Branches
No related tags found
No related merge requests found
...@@ -215,6 +215,29 @@ def RelativisticAverageLoss(non_transformed_disc, type_="G"): ...@@ -215,6 +215,29 @@ def RelativisticAverageLoss(non_transformed_disc, type_="G"):
return loss return loss
# Standard GAN loss functions ---------------------------------------
def gen_loss(non_transformed_disc, fake_image):
fake_logits = non_transformed_disc(fake_image)
fake_loss = tf.nn.sigmoid_cross_entropy_with_logits(
labels=tf.ones_like(fake_logits), logits=fake_logits)
return fake_loss
def disc_loss(non_transformed_disc, real_image, fake_image):
real_logits = non_transformed_disc(real_image)
fake_logits = non_transformed_disc(fake_image)
real_loss = tf.nn.sigmoid_cross_entropy_with_logits(
labels=tf.ones_like(real_logits), logits=real_logits)
fake_loss = tf.nn.sigmoid_cross_entropy_with_logits(
labels=tf.zeros_like(fake_logits), logits=fake_logits)
return real_loss + fake_loss
# ----------------------------------------------------------------------
# Strategy Utils # Strategy Utils
def assign_to_worker(use_tpu): def assign_to_worker(use_tpu):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment