-
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
Rule for svdvals
#587
Comments
I agree, yes, this should be its own rule. We already did that for Hermitian matrices. |
ChainRules.jl/src/rulesets/LinearAlgebra/symmetric.jl Lines 286 to 300 in ffbaa5f
There I ended up having a custom rule. I don't remember why. It may have been faster than using |
Ah, no, it goes via the rrule for |
Requested here: https://discourse.julialang.org/t/implementation-of-spectral-normalization-for-machine-learning/76074
The workaround is to call
svd(X).S
, which is slower forwards. But it looks like the gradient calculation with something likesvd_rev((; U=NoTangent(), s=s, V=NoTangnet(), Vt=NoTangent()), NoTangent(), S̄, NoTangent())
is probably fairly efficient, and could easily be extracted to its own rule:ChainRules.jl/src/rulesets/LinearAlgebra/factorization.jl
Lines 221 to 225 in 3590f94
The text was updated successfully, but these errors were encountered: