-
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
Wrong call on cholesky
rrule
#611
Comments
ChainRules.jl/src/rulesets/LinearAlgebra/factorization.jl Lines 534 to 553 in c5dbe03
Note that the current rules won't compose well if any downstream code accesses ChainRules.jl/src/rulesets/LinearAlgebra/factorization.jl Lines 80 to 169 in c5dbe03
|
So this assumes that
Which is not possible it is obviously a tangent :
|
I don't see anywhere it assumes that. The preceding line has the type annotation |
Right so |
julia> using ChainRulesCore
julia> struct Cholesky
factors
end
julia> F = Cholesky(randn(5, 5));
julia> ΔF = Tangent{typeof(F)}(U=randn(5,5))
Tangent{Cholesky}(U = [-0.7059268385030435 -0.06675693167812352 … -0.2413203958757456 0.03638639429591188; -0.47788794725474393 -1.2764613865307353 … 1.2012293162255412 0.15961345415826841; … ; 0.6552274641328225 0.24813748236499192 … 1.3140512188252975 0.22398055650819915; 2.2445029073821035 -0.5210976005765643 … 1.6755604234385513 0.4181320724677388],)
julia> ΔF.factors
ZeroTangent()
julia> ΔF.U
5×5 Matrix{Float64}:
-0.705927 -0.0667569 -1.42752 -0.24132 0.0363864
-0.477888 -1.27646 -0.652307 1.20123 0.159613
-0.449378 -0.696023 -1.21753 -1.20449 0.23459
0.655227 0.248137 0.0819825 1.31405 0.223981
2.2445 -0.521098 -0.145292 1.67556 0.418132 Note that if this wasn't the current behavior, the rule for |
I think that
Due to
mul! with AbstractZeroTangent arguments (even though I assume one might run into many method ambiguity issues) but I don't think that (all) the examples in the Zygote tests should use a ZeroTangent there, so the primary issue seems to be that Ū is wrong.
|
Can you clarify what you mean here? |
It is a It seems this problem could occur with any hardcoded field access here, so maybe some custom |
It would be helpful if we had an MWE to structure this conversation around. Is there one you can construct from the Zygote failures you mentioned?
Perhaps, but it might be cleaner to rewrite the rrule for ChainRules.jl/src/rulesets/LinearAlgebra/factorization.jl Lines 80 to 169 in c5dbe03
|
Yes, that sounds simpler. |
These Zygote failures happen once one removes the Zygote adjoint for |
The main issue there is that the function I'll open up PRs to both use |
Identified in JuliaStats/PDMats.jl#159
When calling the
cholesky
rrule
, there is an error in the code atChainRules.jl/src/rulesets/LinearAlgebra/factorization.jl
Line 526 in c5dbe03
Ū = ΔC.U
will beNoTangent()
since theTangent
ofCholesky
object does not contain the fieldU
.I think it should be
Ū = ΔC.factors
The text was updated successfully, but these errors were encountered: