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 under ensure ensure_shared_grads? #55

Open
luochao1024 opened this issue Sep 5, 2018 · 1 comment
Open

how to under ensure ensure_shared_grads? #55

luochao1024 opened this issue Sep 5, 2018 · 1 comment

Comments

@luochao1024
Copy link

I am kind of confused of the ensure_shared_grads here https://github.com/ikostrikov/pytorch-a3c/blob/master/train.py#L13. Here, the grad is synced only when it is None. I think we need to set shared_param._grad = param.grad all the time because I don't see we sync the grad anywhere except here. Would anyone give me some hints about it?

@TolgaOk
Copy link

TolgaOk commented Nov 27, 2018

When you shared the model parameters grad attribute is not shared, so each process needs to have their own grad attribute and that's why we only need to assign it once for every process.

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

2 participants