Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BJavid opened this issue Dec 26, 2023 · 0 comments
Open

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

BJavid opened this issue Dec 26, 2023 · 0 comments

Comments

@BJavid
Copy link

BJavid commented Dec 26, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant