Constant loss for D and G with GANs

444 views
Skip to first unread message

Rafael Valle

unread,
Feb 1, 2017, 3:35:42 PM2/1/17
to lasagn...@googlegroups.com
Hey all,


I'm training a GAN using the traditional generator and discriminator loss functions, being -log(D(G(z)) and -log(D(x)) -log(1 - D(G(z)) respectively.

For some reason the loss for the discriminator and the generator are always constant, with the generator loss being close to 0 and the discriminator loss being proportional to the batch size.

Changing the loss functions to categorical cross-entropy on two labels, real or fake, the network behaves normally.

Does anyone have an idea how to solve this? The code in on the link below.




Rafael Valle

unread,
Feb 3, 2017, 10:33:44 PM2/3/17
to lasagne-users
Just realized that I was using softmax as nonlinearity instead of sigmoid.
In this case it would be very useful to have a warning message saying that softmax is being applied to a single unit layer :-)

Jan Schlüter

unread,
Feb 6, 2017, 12:41:14 PM2/6/17
to lasagne-users
Just realized that I was using softmax as nonlinearity instead of sigmoid.
In this case it would be very useful to have a warning message saying that softmax is being applied to a single unit layer :-)

Good idea. Theano often doesn't know the shape of softmax inputs, but with Lasagne, it can tell whether there's a single unit (because that dimension will be broadcastable).
Reply all
Reply to author
Forward
0 new messages