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

Can someone inform me why we need tf.clip_by_value(x,-1,1) before tf.sign(x) #8

Open
Sibo-tao opened this issue May 18, 2018 · 2 comments

Comments

@Sibo-tao
Copy link

I do not understand why there are two lines of codes in binarize(x):
x=tf.clip_by_value(x,-1,1)
return tf.sign(x)

because clipping will not change the sign of x. Why we need the first line?

@jonkoi
Copy link

jonkoi commented Aug 1, 2018

I think it is the way to reinforce straight through estimator because tf.clip_by_value happens to zero out out gradients for x out of bound.

@12baby21
Copy link

I have the same question. The tf.clip_by_value seems to be redundant before tf.sign.

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

3 participants