geek-ai / Texygen

A text generation benchmarking platform
MIT License
863 stars 203 forks source link

Question of Generator Loss of MaliGAN #47

Open cyk1337 opened 4 years ago

cyk1337 commented 4 years ago

Is the generator loss of MaliGAN correct? It should be:

image

https://github.com/geek-ai/Texygen/blob/3104e22ac75f3cc2070da2bf5e2da6d2bef149ad/models/maligan_basic/MaliganGenerator.py#L112

        self.g_loss = -tf.reduce_sum(
            tf.reduce_sum(
                tf.one_hot(tf.to_int32(tf.reshape(self.x, [-1])), self.num_vocabulary, 1.0, 0.0) * tf.log(
                    tf.clip_by_value(tf.reshape(self.g_predictions, [-1, self.num_vocabulary]), 1e-20, 1.0)
                ), 1) * tf.reshape(self.rewards, [-1])
        )