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

NaN Issue with SAC Code #7

Open
SaifAlWahaibi opened this issue May 17, 2023 · 0 comments
Open

NaN Issue with SAC Code #7

SaifAlWahaibi opened this issue May 17, 2023 · 0 comments

Comments

@SaifAlWahaibi
Copy link

action = T.tanh(actions)*T.tensor(self.max_action).to(self.device)
log_probs = probabilities.log_prob(actions)
log_probs -= T.log(1-action.pow(2) + self.reparam_noise) --> produces negative outputs inside the log, which in turn produces nan
log_probs = log_probs.sum(1, keepdim=True)

How can I fix this issue? Are the following modifications correct?

action = T.tanh(actions)*T.tensor(self.max_action).to(self.device)
log_probs = probabilities.log_prob(actions)
log_probs -= T.log(1-T.tanh(actions).pow(2) + self.reparam_noise)
log_probs = log_probs.sum(1, keepdim=True)

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