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

Question about backward hook #24

Open
OValery16 opened this issue Jun 30, 2020 · 0 comments
Open

Question about backward hook #24

OValery16 opened this issue Jun 30, 2020 · 0 comments

Comments

@OValery16
Copy link

Thank you for work and sharing this code.

I was wondering the meaning of new_grad = torch.ones_like(grad) in the following code in universal.py.


    def _backward_hook(self, grad):
        self.out_mask += grad.data.abs().sum(2, keepdim=True).sum(3, keepdim=True).cpu().sum(0, keepdim=True).view(-1)
        new_grad = torch.ones_like(grad)
        return new_grad

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

1 participant