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

if there's no "if shared_param.grad is not None: return" what will happen? #79

Open
yinqinghai opened this issue Jun 14, 2023 · 1 comment

Comments

@yinqinghai
Copy link

        if shared_param.grad is not None:
            return
        shared_param._grad = param.grad

in this code, if there's no if shared_param.grad is not None: return shared_param._grad will be assigned each time? maybe just some performance loss?
maybe a stupid question, but i'm curious, thanks in advance.

@zhuzhu18
Copy link

我也感觉这个if语句没啥作用,每个子进程中的shared_model的梯度在zero_grad后都被置为None了,而且在进程之间还不共享

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