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

Component array enzyme fix #150

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added an explicit type conversion to make ComponentVectors work with …
…Enzyme
  • Loading branch information
benjaminfaber committed Jul 24, 2024
commit 6e5bcdc0bdbf9ae0bd3aa7309233827a30651d02
3 changes: 2 additions & 1 deletion ext/ImplicitDifferentiationEnzymeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ function EnzymeRules.forward(
y_or_yz = implicit(x, args...)
y = output(y_or_yz)
Y = typeof(y)
X = typeof(x)

suggested_backend = AutoEnzyme(Enzyme.Forward)
A = build_A(implicit, x, y_or_yz, args...; suggested_backend)
B = build_B(implicit, x, y_or_yz, args...; suggested_backend)

dx_batch = reduce(hcat, dx)
dc_batch = mapreduce(hcat, eachcol(dx_batch)) do dₖx
B * dₖx
B * X(dₖx)
end
dy_batch = implicit.linear_solver(A, -dc_batch)

Expand Down