@@ -93,7 +93,6 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
93
93
g = false , h = false , hv = false , fg = false , fgh = false ,
94
94
cons_j = false , cons_vjp = false , cons_jvp = false , cons_h = false ,
95
95
lag_h = false )
96
-
97
96
if g == true && f. grad === nothing
98
97
function grad (res, θ)
99
98
Enzyme. make_zero! (res)
@@ -351,7 +350,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
351
350
k += i
352
351
end
353
352
end
354
- elseif lag_h == true && cons != = nothing
353
+ elseif lag_h == true && cons != = nothing
355
354
lag_h! = (θ, σ, μ) -> f. lag_h (θ, σ, μ, p)
356
355
else
357
356
lag_h! = nothing
@@ -384,11 +383,10 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true},
384
383
end
385
384
386
385
function OptimizationBase. instantiate_function (f:: OptimizationFunction{false} , x,
387
- adtype:: AutoEnzyme , p, num_cons = 0 ;
386
+ adtype:: AutoEnzyme , p, num_cons = 0 ;
388
387
g = false , h = false , hv = false , fg = false , fgh = false ,
389
388
cons_j = false , cons_vjp = false , cons_jvp = false , cons_h = false ,
390
389
lag_h = false )
391
-
392
390
if g == true && f. grad === nothing
393
391
res = zeros (eltype (x), size (x))
394
392
function grad (θ)
@@ -637,10 +635,10 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{false}, x
637
635
lag_h! = nothing
638
636
end
639
637
640
- return OptimizationFunction {false} (f. f, adtype; grad = grad,
638
+ return OptimizationFunction {false} (f. f, adtype; grad = grad,
641
639
fg = fg!, fgh = fgh!,
642
640
hess = hess, hv = hv!,
643
- cons = cons, cons_j = cons_j!,
641
+ cons = cons, cons_j = cons_j!,
644
642
cons_jvp = cons_jvp!, cons_vjp = cons_vjp!,
645
643
cons_h = cons_h!,
646
644
hess_prototype = f. hess_prototype,
0 commit comments