4141function hv_f2_alloc (x, f, p)
4242 dx = Enzyme. make_zero (x)
4343 Enzyme. autodiff_deferred (Enzyme. Reverse,
44- firstapply,
44+ Const ( firstapply) ,
4545 Active,
4646 Const (f),
4747 Enzyme. Duplicated (x, dx),
@@ -58,7 +58,8 @@ function inner_cons(x, fcons::Function, p::Union{SciMLBase.NullParameters, Nothi
5858end
5959
6060function cons_f2 (x, dx, fcons, p, num_cons, i)
61- Enzyme. autodiff_deferred (Enzyme. Reverse, inner_cons, Active, Enzyme. Duplicated (x, dx),
61+ Enzyme. autodiff_deferred (
62+ Enzyme. Reverse, Const (inner_cons), Active, Enzyme. Duplicated (x, dx),
6263 Const (fcons), Const (p), Const (num_cons), Const (i))
6364 return nothing
6465end
7172
7273function cons_f2_oop (x, dx, fcons, p, i)
7374 Enzyme. autodiff_deferred (
74- Enzyme. Reverse, inner_cons_oop, Active, Enzyme. Duplicated (x, dx),
75+ Enzyme. Reverse, Const ( inner_cons_oop) , Active, Enzyme. Duplicated (x, dx),
7576 Const (fcons), Const (p), Const (i))
7677 return nothing
7778end
@@ -83,7 +84,8 @@ function lagrangian(x, _f::Function, cons::Function, p, λ, σ = one(eltype(x)))
8384end
8485
8586function lag_grad (x, dx, lagrangian:: Function , _f:: Function , cons:: Function , p, σ, λ)
86- Enzyme. autodiff_deferred (Enzyme. Reverse, lagrangian, Active, Enzyme. Duplicated (x, dx),
87+ Enzyme. autodiff_deferred (
88+ Enzyme. Reverse, Const (lagrangian), Active, Enzyme. Duplicated (x, dx),
8789 Const (_f), Const (cons), Const (p), Const (λ), Const (σ))
8890 return nothing
8991end
@@ -187,7 +189,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
187189 if hv == true && f. hv === nothing
188190 function hv! (H, θ, v, p = p)
189191 H .= Enzyme. autodiff (
190- Enzyme. Forward, hv_f2_alloc, DuplicatedNoNeed, Duplicated (θ, v),
192+ Enzyme. Forward, hv_f2_alloc, Duplicated (θ, v),
191193 Const (f. f), Const (p)
192194 )[1 ]
193195 end
@@ -531,7 +533,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{false}, x
531533 for i in eachindex (Jaccache)
532534 Enzyme. make_zero! (Jaccache[i])
533535 end
534- y, Jaccache = Enzyme. autodiff (Enzyme. Forward , f. cons, Duplicated,
536+ Jaccache, y = Enzyme. autodiff (Enzyme. ForwardWithPrimal , f. cons, Duplicated,
535537 BatchDuplicated (θ, seeds), Const (p))
536538 if size (y, 1 ) == 1
537539 return reduce (vcat, Jaccache)
0 commit comments