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

differentiable type includes integer? #419

Open
hailijuan opened this issue Dec 6, 2019 · 2 comments
Open

differentiable type includes integer? #419

hailijuan opened this issue Dec 6, 2019 · 2 comments

Comments

@hailijuan
Copy link

say f(x)=2x, f'(10) gets 2. Seen from @code_llvm, the gradient function of f simply returns 2.

What is differentiable type in Zygote? What is non-differentiable type? Here 10 is integer type. Does it matter or not?

@Roger-luo
Copy link
Contributor

It's a good point I think, there's no discussion about this before, since most people focus on how to make things work at the moment.

I believe you can always block these by adding more restricted rules, I think currently it's just because it is generated from DiffRules directly: https://github.com/FluxML/Zygote.jl/blob/master/src/lib/number.jl#L8

However, I'm not sure if there are any actual use cases that will use Integer in reverse mode, thus I'm not sure if we should have more restrict rules on this,

PS. maybe should just dispatch to ChainRules in the future to let ChainRules handle this?

@MikeInnes
Copy link
Member

See the first half of this comment. In particular: types are not differentiable or non-differentiable, they just represent certain values. Functions can be continuous or discontinuous, differentiable or non-differentiable, etc.

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