Created
October 26, 2020 13:20
-
-
Save pranjalAI/467d73516faf550dcf4698fb743d53f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cross_entropy = tf.keras.losses.BinaryCrossentropy(from_logits=True) | |
def discriminator_loss(real_output, fake_output): | |
real_loss = cross_entropy(tf.ones_like(real_output), real_output) | |
fake_loss = cross_entropy(tf.zeros_like(fake_output), fake_output) | |
total_loss = real_loss + fake_loss | |
return total_loss | |
def generator_loss(fake_output): | |
return cross_entropy(tf.ones_like(fake_output), fake_output) | |
generator_optimizer = tf.keras.optimizers.Adam(1.5e-4,0.5) | |
discriminator_optimizer = tf.keras.optimizers.Adam(1.5e-4,0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment