Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 9130204

Browse files
authored
Update OptimizationEnzymeExt.jl
1 parent 1607b88 commit 9130204

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ext/OptimizationEnzymeExt.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ function set_runtime_activity2(
8484
a::Mode1, ::Enzyme.Mode{ABI, Err, RTA}) where {Mode1, ABI, Err, RTA}
8585
Enzyme.set_runtime_activity(a, RTA)
8686
end
87+
function_annotation(::Nothing) = Nothing
88+
function_annotation(::AutoEnzyme{<:Any, A}) = A
8789
function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
8890
adtype::AutoEnzyme, p, num_cons = 0;
8991
g = false, h = false, hv = false, fg = false, fgh = false,
@@ -101,11 +103,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
101103
set_runtime_activity2(Enzyme.Forward, adtype.mode)
102104
end
103105

104-
func_annot = if adtype.mode isa Nothing
105-
Nothing
106-
else
107-
adtype.function_annotation
108-
end
106+
func_annot = function_annotation(adtype.function_annotation)
109107

110108
if g == true && f.grad === nothing
111109
function grad(res, θ, p = p)

0 commit comments

Comments
 (0)