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

Gradients are dropped when using a sparse cholesky #1825

Open
ptiede opened this issue Sep 14, 2024 · 0 comments
Open

Gradients are dropped when using a sparse cholesky #1825

ptiede opened this issue Sep 14, 2024 · 0 comments

Comments

@ptiede
Copy link

ptiede commented Sep 14, 2024

I just realized I get zeros in my gradient when using a sparse cholesky. Here is a MWE

using Enzyme
using SparseArrays
using LinearAlgebra
using FiniteDifferences


function f(C, x)
    y = C\x
    return sum(abs2, y)
end

S = sprand(4, 4, 0.5)
C = cholesky(S'S + 0.1I)

x = ones(4)
dx = zero(x)
autodiff(Reverse, f, Active, Const(C), Duplicated(x, dx))

fdm = central_fdm(5,1)
gfd, = grad(fdm, x->f(C, x), x)

@show gfd
gfd = [-28.632697807114134, 119.34259912937537, -11.822709134186741, -0.4882945852142454]

@show dx
dx = [0.0, 0.0, 0.0, 0.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant