-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add rules for division by Cholesky #631
Conversation
I'm not sure if this should be added here. Are there other examples in ChainRules where a rule is implemented only because the primal is mutating? At first glance this seems like a Zygote specific issue that should be addressed there. Or more generally a problem of mutation-incompatible ADs, so maybe one should only define it for It also seems this problem might affect factorizations more generally? https://github.com/JuliaLang/julia/blob/ae89f8b00a6e785832e4f47de73599e032aa9674/stdlib/LinearAlgebra/src/factorization.jl#L103 |
Yes, there are number of rules defined due to mutation; most are not documented as such, but see https://github.com/JuliaDiff/ChainRules.jl/search?q=mutates. The rules don't belong in Zygote, since other ADs like Diffractor will also need them. In the past, we have added rules that cover up mutation so that they can be removed from Zygote.
Yeah that's an interesting idea. I wonder why we haven't done that in the past. @oxinabox @mcabbott do you know?
Yes, but unfortunately the solution is specific to each factorization. We handle this one here since there's a corresponding adjoint in Zygote we'd like to remove. |
I suppose one hang-up is that there is no |
I am in no hurry to add it. and ReverseDiff is opt in per rule anyway, |
\(::Cholesky, ::AbstractVecOrMat)
and/(::AbstractMatrix, ::Cholesky)
internally callldiv!
andrdiv!
, respectively. This PR addsrrule
s for these functions to cover this up. This also allows the correspond adjoint for\
to be removed from Zygote.Fixes #611