MCPcopy Create free account
hub / github.com/SystemErrorWang/White-box-Cartoonization / gan_loss

Function gan_loss

train_code/loss.py:149–160  ·  view source on GitHub ↗
(discriminator, real, fake, scale=1,channel=32, patch=False, name='discriminator')

Source from the content-addressed store, hash-verified

147
148
149def gan_loss(discriminator, real, fake, scale=1,channel=32, patch=False, name='discriminator'):
150
151 real_logit = discriminator(real, scale, channel, name=name, patch=patch, reuse=False)
152 fake_logit = discriminator(fake, scale, channel, name=name, patch=patch, reuse=True)
153
154 real_logit = tf.nn.sigmoid(real_logit)
155 fake_logit = tf.nn.sigmoid(fake_logit)
156
157 g_loss_blur = -tf.reduce_mean(tf.log(fake_logit))
158 d_loss_blur = -tf.reduce_mean(tf.log(real_logit) + tf.log(1. - fake_logit))
159
160 return d_loss_blur, g_loss_blur
161
162
163

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected