-
Notifications
You must be signed in to change notification settings - Fork 42
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
autoback_hesvec
fails with SparseMatrixCSC
#180
Comments
It seems like it's creating a SparseMatrixCSC of Float64. @DhairyaLGandhi how would I investigate why? |
any update on this? I too encountered this problem today. |
was a bit of an odd response in JuliaGraphs/GraphNeuralNetworks.jl#125 that lead to this issue. The issue should be reported in ChainRules.jl because it's ChainRules.jl that needs a fix. There's no code that could/should be changed to handle this here, any code change would have to happen in ChainRules.jl to fix this. So waiting on a SparseDiffTools.jl change is not going to lead anywhere 😅. Here's a version of the issue that uses no code from SparseDiffTools: using Zygote, SparseArrays, ForwardDiff
x, v = rand(Float32, 5), rand(Float32, 5)
A = sprand(Float32, 5, 5, 0.5)
loss(_x) = sum(tanh.(A * _x))
T = typeof(ForwardDiff.Tag(nothing, eltype(x)))
y = ForwardDiff.Dual{T, eltype(x), 1}.(x, ForwardDiff.Partials.(tuple.(reshape(v, size(x)))))
g = x -> first(Zygote.gradient(loss, x))
y = _default_autoback_hesvec_cache(x, v)
ForwardDiff.partials.(g(y), 1) Let's take that upstream. |
JuliaDiff/ChainRulesCore.jl#648 is the upstream issue. |
Hello! I can't seem to use
autoback_hesvec
when the function includes a sparse CSC matrix.with the full message
This is with
[47a9eef4] SparseDiffTools v1.20.0
and[082447d4] ChainRules v1.26.0
. The issue was originally noticed here, where it was suggested to be reported here instead.The text was updated successfully, but these errors were encountered: