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

Commit 1cb3aa3

Browse files
format
1 parent b13c812 commit 1cb3aa3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ext/OptimizationEnzymeExt.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using Core: Vararg
1717
end
1818
end
1919

20-
function inner_grad(mode::Mode, θ, bθ, f, p) where Mode
20+
function inner_grad(mode::Mode, θ, bθ, f, p) where {Mode}
2121
Enzyme.autodiff(mode,
2222
Const(firstapply),
2323
Active,
@@ -28,7 +28,7 @@ function inner_grad(mode::Mode, θ, bθ, f, p) where Mode
2828
return nothing
2929
end
3030

31-
function hv_f2_alloc(mode::Mode, x, f, p) where Mode
31+
function hv_f2_alloc(mode::Mode, x, f, p) where {Mode}
3232
dx = Enzyme.make_zero(x)
3333
Enzyme.autodiff(mode,
3434
Const(firstapply),
@@ -80,14 +80,15 @@ function lag_grad(mode, x, dx, lagrangian::Function, _f::Function, cons::Functio
8080
return nothing
8181
end
8282

83-
84-
set_runtime_activity2(a::Mode1, ::Enzyme.Mode{ABI, Err, RTA}) where {Mode1, ABI, Err, RTA} = Enzyme.set_runtime_activity(a, RTA)
83+
function set_runtime_activity2(
84+
a::Mode1, ::Enzyme.Mode{ABI, Err, RTA}) where {Mode1, ABI, Err, RTA}
85+
Enzyme.set_runtime_activity(a, RTA)
86+
end
8587
function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
8688
adtype::AutoEnzyme, p, num_cons = 0;
8789
g = false, h = false, hv = false, fg = false, fgh = false,
8890
cons_j = false, cons_vjp = false, cons_jvp = false, cons_h = false,
8991
lag_h = false)
90-
9192
rmode = if adtype.mode isa Nothing
9293
Enzyme.Reverse
9394
else
@@ -97,7 +98,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
9798
fmode = if adtype.mode isa Nothing
9899
Enzyme.Forward
99100
else
100-
set_runtime_activity2(Enzyme.Forward. adtype.mode)
101+
set_runtime_activity2(Enzyme.Forward.adtype.mode)
101102
end
102103

103104
if g == true && f.grad === nothing

0 commit comments

Comments
 (0)