@KrnTneja : Thanks for your tricks. Could you provide any code to do it? I also meet the problem of loss D goes to zero
There isn't really any code to show. Just ensure that last layer of your discriminator is not a sigmoid layer i.e. output shouldn't be constrained to [0,1]. I was using PyTorch, where I had to use torch.nn.BCEWithLogitsLoss instead of torch.nn.BCELoss.
I understand that getting rid of sigmoid function resolved this problem (using torch.nn.BCEloss instead of torch.nn.BCEwithLogitsLoss). I have two questions:
Did you use any other activation function instead of 'sigmoid' or just didn't use any activation for the last layer?
Can you please share any insight about why this worked?
There isn't really any code to show. Just ensure that last layer of your discriminator is not a sigmoid layer i.e. output shouldn't be constrained to
[0,1]
. I was using PyTorch, where I had to usetorch.nn.BCEWithLogitsLoss
instead oftorch.nn.BCELoss
.Originally posted by @KrnTneja in https://github.com/soumith/ganhacks/issues/36#issuecomment-493886559