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

questions about log_prob implementation? #1

Open
dragen1860 opened this issue Aug 28, 2019 · 0 comments
Open

questions about log_prob implementation? #1

dragen1860 opened this issue Aug 28, 2019 · 0 comments

Comments

@dragen1860
Copy link

Hi, thanks for your PG implementation.
I found it's difficult to understand this episode code:

	#train model
	def log_prob(self, policy_param, acs):
		if self.is_discrete:
			logits = policy_param
			log_prob = tf.keras.losses.sparse_categorical_crossentropy(\
				y_true = acs, y_pred = logits, from_logits = True)

I think the log_prob function will just return tf.math.log(policy_param) and I do not understand why you calculate crossentropy loss here? 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