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

Function lsgan_loss

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

Source from the content-addressed store, hash-verified

162
163
164def lsgan_loss(discriminator, real, fake, scale=1,
165 channel=32, patch=False, name='discriminator'):
166
167 real_logit = discriminator(real, scale, channel, name=name, patch=patch, reuse=False)
168 fake_logit = discriminator(fake, scale, channel, name=name, patch=patch, reuse=True)
169
170 g_loss = tf.reduce_mean((fake_logit - 1)**2)
171 d_loss = 0.5*(tf.reduce_mean((real_logit - 1)**2) + tf.reduce_mean(fake_logit**2))
172
173 return d_loss, g_loss
174
175
176

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected