SentiGAN icon indicating copy to clipboard operation
SentiGAN copied to clipboard

how to change ths loss function of the generator in code

Open BJavid opened this issue 2 years ago • 0 comments

Hi Could you please guide me how to change the generator loss function in the code? I'm going to change this function:

image

Which part of the relevant code should be changed?

self.rewards = tf.placeholder(dtype=tf.float32, shape=[None, None]) self.rewards_loss = tf.reduce_sum( tf.reduce_sum( tf.one_hot(tf.to_int32(tf.reshape(self.x, [-1])), self.num_emb, 1.0, 0.0) * tf.clip_by_value( tf.reshape(self.g_predictions, [-1, self.num_emb]), 1e-20, 1.0) , 1) * tf.reshape(self.rewards, [-1]) # * tf.reshape(self.target_weights, [-1]) ) optimizer_gan = tf.train.RMSPropOptimizer(self.learning_rate) gradients_gan, v_gan = zip(*optimizer_gan.compute_gradients(self.rewards_loss)) gradients_gan, _gan = tf.clip_by_global_norm(gradients_gan, self.grad_clip) self.rewards_updates = optimizer_gan.apply_gradients(zip(gradients_gan, v_gan), global_step=self.global_step)

or elsewhere?

Thank you

BJavid avatar Dec 26 '23 07:12 BJavid