From 155d05e75d8e4b70804728f2a2091053ace16f04 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 26 Sep 2024 09:22:10 -0400 Subject: [PATCH] test: new enzyme version --- Project.toml | 4 ++-- ext/SparseDiffToolsEnzymeExt.jl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 5f26e896..f566bf0c 100644 --- a/Project.toml +++ b/Project.toml @@ -4,7 +4,7 @@ authors = [ "Pankaj Mishra ", "Chris Rackauckas ", ] -version = "2.20.0" +version = "2.21.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" @@ -48,7 +48,7 @@ Adapt = "3, 4" ArrayInterface = "7.4.2" Compat = "4" DataStructures = "0.18" -Enzyme = "0.11,0.12" +Enzyme = "0.13" FiniteDiff = "2.8.1" ForwardDiff = "0.10" Graphs = "1" diff --git a/ext/SparseDiffToolsEnzymeExt.jl b/ext/SparseDiffToolsEnzymeExt.jl index 6ed4dc1c..a6e85f01 100644 --- a/ext/SparseDiffToolsEnzymeExt.jl +++ b/ext/SparseDiffToolsEnzymeExt.jl @@ -27,7 +27,8 @@ function __gradient!(::Union{AutoSparse{<:AutoEnzyme}, AutoEnzyme}, f!, fx, x, c end function __jacobian!(J::AbstractMatrix, ::Union{AutoSparse{<:AutoEnzyme}, AutoEnzyme}, f, x) - J .= jacobian(Reverse, f, x, Val(size(J, 1))) + J .= only(jacobian( + Reverse, a -> vec(f(reshape(a, size(x)))), vec(x); n_outs = Val(size(J, 1)))) return J end