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

abs backward function #2

Closed
qiulinzhang opened this issue Aug 19, 2021 · 3 comments
Closed

abs backward function #2

qiulinzhang opened this issue Aug 19, 2021 · 3 comments

Comments

@qiulinzhang
Copy link

Thanks for your great paper. I have one question about the class absol, line 31, https://github.com/cvlab-yonsei/DAQ/blob/main/models/resnet20_DAQ.py,
I don't understand your backward function, there seems a lot of redundant operation after grad_input = torch.sign(input). Is there any specific explanation about this backward function.

@Shape-Kim
Copy link
Contributor

I am sorry to confuse you. As you say, it might be unnecessary operation after ''grad_input = torch.sign(input)''. Thank you!

@qiulinzhang
Copy link
Author

I am sorry to confuse you. As you say, it might be unnecessary operation after ''grad_input = torch.sign(input)''. Thank you!

I understand suddenly , for floating point zero, using torch.sign will get 0. However, the derivative at zero for abs function is not differentiable. using this backward function, we will get sign 1 for number 0. I worry about my guess is correct or not.

@Shape-Kim
Copy link
Contributor

Your guess is correct! Thank you!

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