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 regarding hard rounding #1

Open
KwangHoonAn opened this issue Feb 24, 2021 · 1 comment
Open

Question regarding hard rounding #1

KwangHoonAn opened this issue Feb 24, 2021 · 1 comment

Comments

@KwangHoonAn
Copy link

else:
x_int = x_floor + (self.alpha >= 0).float()

Would you elaborate how you derived hard-rounding scheme and what's the use of it?

@yhhhli
Copy link
Owner

yhhhli commented Feb 24, 2021

Hi,

In hard rounding mode, we first round down the tensor (i.e, flooring). Then (self.alpha >= 0).float() is used to determine either rounding up or rounding down. When alpha is less than 0, it is 0, otherwise, it would be 1 and therefore round up the weights.

For mathematical explanation, you can find it on the paper. https://arxiv.org/abs/2004.10568

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