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

Big bug in PPO2 #35

Open
Vinson-sheep opened this issue Feb 16, 2022 · 3 comments
Open

Big bug in PPO2 #35

Vinson-sheep opened this issue Feb 16, 2022 · 3 comments

Comments

@Vinson-sheep
Copy link

In dist = Normal(mu, sigma) , sigma should be a positive value, but actor_net output can be negative, so action_log_prob = dist.log_prob(action) can be nan.

Try:

import torch
a = torch.FloatTensor([1]).cuda()
b = torch.FloatTensor([-1]).cuda()
dist = Normal(a,b)
action = dist.sample()
action_log_prob = dist.log_prob(action)

print(action.cpu().numpy())
print(action_log_prob.item())
@jzl20
Copy link

jzl20 commented Apr 15, 2022

so how can I fix the bug ?

@flyinglife001
Copy link

return sigma*sigma

@WhiteNightSleepless
Copy link

You can add an activation function before the output of actor network. Using relu or softplus function may change sigma into a positive value. Hope it helps.

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

4 participants