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

rand! is marked non-differentiable #603

Open
willtebbutt opened this issue Mar 28, 2022 · 2 comments · May be fixed by #604
Open

rand! is marked non-differentiable #603

willtebbutt opened this issue Mar 28, 2022 · 2 comments · May be fixed by #604

Comments

@willtebbutt
Copy link
Member

This fallback method for rand in Distributions.jl hits this rule, which is declared non-differentiable.

This results in a silent failure, where there ought to be an error if the given AD (in my case Zygote), is unable to handle in-place differentiation.

@willtebbutt willtebbutt linked a pull request Mar 28, 2022 that will close this issue
@mcabbott
Copy link
Member

mcabbott commented Mar 28, 2022

Xref fill! discussion in #521 .

Can you explain more what the Distributions example is meant to show? At some level rand! by itself is obviously wrong:

julia> gradient([1,2,3.0]) do x
         rand!(x)
         x[1]
       end
([1.0, 0.0, 0.0],)

but you seem to be saying something more specific.

@mcabbott mcabbott changed the title Silent Gradient Drop rand! is marked non-differentiable Mar 28, 2022
@willtebbutt
Copy link
Member Author

Can you explain more what the Distributions example is meant to show?

I think I'm essentially saying the thing that you are pointing out, it's just that this is the particular example that was causing me problems.

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

Successfully merging a pull request may close this issue.

2 participants