Skip to content

how to change ths loss function of the generator in code #11

@BJavid

Description

@BJavid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions