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

sparsity gets lost: sparse array input -> dense array output #118

Closed
thorek1 opened this issue Sep 3, 2023 · 2 comments
Closed

sparsity gets lost: sparse array input -> dense array output #118

thorek1 opened this issue Sep 3, 2023 · 2 comments
Labels
feature New feature or request

Comments

@thorek1
Copy link
Contributor

thorek1 commented Sep 3, 2023

it would be good to preserve sparsity.
the culprit in the ForwardDiff extension is:

y_and_dy = map(eachindex(IndexCartesian(), y)) do i
    Dual{T}(y[i], Partials(ntuple(k -> dy[k][i], Val(N))))
end

which always creates a dense array

@gdalle
Copy link
Member

gdalle commented Sep 6, 2023

I agree it would be good, but see #21, sparse arrays already have some problems with ForwardDiff.jl that cannot be solved

@gdalle gdalle added the feature New feature or request label Sep 6, 2023
@gdalle
Copy link
Member

gdalle commented Apr 10, 2024

The latest version v0.6.0 no longer supports matrices, only vectors. If you want sparsity, you need to create the sparse matrix inside the function. Enzyme takes a similar approach, and it avoids lots of headaches
https://discourse.julialang.org/t/how-do-you-speed-up-the-linear-sparse-solver-in-zygote/111801/27?u=gdalle

@gdalle gdalle closed this as completed Apr 10, 2024
@gdalle gdalle reopened this Apr 10, 2024
@gdalle gdalle closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants