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

About gradient balancing #23

Open
miranghimire opened this issue Dec 23, 2021 · 1 comment
Open

About gradient balancing #23

miranghimire opened this issue Dec 23, 2021 · 1 comment

Comments

@miranghimire
Copy link

miranghimire commented Dec 23, 2021

There are three backward calls inside gardient balancing between generator loss & OCR loss:

Won't these calls accumulate the gradients during the call of optimizer.step(); I thought our objective here was to simply compute the gardient balancing terms and multiply those to the loss or could you please give overview of what's going on here inside gradient balancing incase I misunderstood something?

@sharonFogel
Copy link

I just looked at the code, I think you're right and there should be self.netG.zero_grad() between the first and second backprop. The third one is performed without gradient accumulation just so that the graph won't be retained.

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