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

@nograd rand a bit overzealous #49

Closed
willtebbutt opened this issue Dec 20, 2018 · 1 comment
Closed

@nograd rand a bit overzealous #49

willtebbutt opened this issue Dec 20, 2018 · 1 comment

Comments

@willtebbutt
Copy link
Member

willtebbutt commented Dec 20, 2018

rand is currently flagged as a @nograd. While this is probably appropriate for the methods of rand one finds in Base, it's certainly not for things in Distributions. For example:

Zygote.gradient(x->rand(Normal(x, 1)), x)

Here the gradient w.r.t. x definitely shouldn't be zero in the general case.

I would suggest that @nograd should be extended slightly to allow it to be applied only to specific methods of function.

@MikeInnes
Copy link
Member

@nograd is more-or-less a hack that I added back when everything was segfaulting, so simple examples would work. As you point out, it's basically never useful in its current form since it's almost always overly general.

Feel free to delete the @nograd usages entirely where they don't break the tests, or otherwise to just add more sensible definitions.

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