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

Chapter 10 - Advantage computed the wrong way? #74

Open
ghost opened this issue May 14, 2020 · 2 comments
Open

Chapter 10 - Advantage computed the wrong way? #74

ghost opened this issue May 14, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented May 14, 2020

https://ai.stackexchange.com/questions/21172/advantage-computed-the-wrong-way

ipdb> adv_v.shape                                                                                                                            
torch.Size([128, 128])

ipdb> vals_ref_v.shape                                                                                                                       
torch.Size([128])

ipdb> values_v.detach().shape                                                                                                                
torch.Size([128, 1]) 
@ghost
Copy link
Author

ghost commented May 15, 2020

I changed the line adv_v = vals_ref_v - value_v.detach() to adv_v = vals_ref_v - value_v.squeeze(-1).detach(). It seems the convergence is much faster. According to the A2C algorithm, it is just logic to apply Q(a, s) - V(s) where Q(a, s) and V(s) with the same shape.

The call to detach() is important here as we don't want to propagate the PG into our value approximation head.

@ghost
Copy link
Author

ghost commented May 15, 2020

Selection_028

Selection_027

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

No branches or pull requests

0 participants