ZiJianZhao / SeqGAN-PyTorch

A implementation of SeqGAN in PyTorch, following the implementation in tensorflow.
260 stars 93 forks source link

Why do you use math.exp? #4

Open KazutoshiShinoda opened 6 years ago

KazutoshiShinoda commented 6 years ago

https://github.com/ZiJianZhao/SeqGAN-PyTorch/blob/master/main.py#L87

why?

In the original implementation by LantaoYu, exp is not used for loss values.

ShengleiH commented 6 years ago

@shinochin hello, because 'NLLLoss' is used which is 'NLLLoss(x) = log(softmax(x))'. Therefore, to get the softmax results, you need to do this: 'softmax(x) = exp(NLLLoss(x))'

deepylt commented 6 years ago

But total_loss / total_words seems weird since the discriminator loss is not related to the sequence length.