@@ -30,7 +30,7 @@ function OptimizationBase.instantiate_function(
30
30
adtype, soadtype = OptimizationBase. generate_adtype (adtype)
31
31
32
32
if g == true && f. grad === nothing
33
- prep_grad = prepare_gradient (f. f, adtype, x, Constant (p))
33
+ prep_grad = prepare_gradient (f. f, adtype, x, Constant (p), strict = Val ( false ) )
34
34
function grad (res, θ)
35
35
gradient! (f. f, res, prep_grad, adtype, θ, Constant (p))
36
36
end
@@ -47,7 +47,7 @@ function OptimizationBase.instantiate_function(
47
47
48
48
if fg == true && f. fg === nothing
49
49
if g == false
50
- prep_grad = prepare_gradient (f. f, adtype, x, Constant (p))
50
+ prep_grad = prepare_gradient (f. f, adtype, x, Constant (p), strict = Val ( false ) )
51
51
end
52
52
function fg! (res, θ)
53
53
(y, _) = value_and_gradient! (f. f, res, prep_grad, adtype, θ, Constant (p))
@@ -68,7 +68,7 @@ function OptimizationBase.instantiate_function(
68
68
hess_sparsity = f. hess_prototype
69
69
hess_colors = f. hess_colorvec
70
70
if h == true && f. hess === nothing
71
- prep_hess = prepare_hessian (f. f, soadtype, x, Constant (p))
71
+ prep_hess = prepare_hessian (f. f, soadtype, x, Constant (p), strict = Val ( false ) )
72
72
function hess (res, θ)
73
73
hessian! (f. f, res, prep_hess, soadtype, θ, Constant (p))
74
74
end
@@ -143,7 +143,7 @@ function OptimizationBase.instantiate_function(
143
143
cons_jac_prototype = f. cons_jac_prototype
144
144
cons_jac_colorvec = f. cons_jac_colorvec
145
145
if cons != = nothing && cons_j == true && f. cons_j === nothing
146
- prep_jac = prepare_jacobian (cons_oop, adtype, x)
146
+ prep_jac = prepare_jacobian (cons_oop, adtype, x, strict = Val ( false ) )
147
147
function cons_j! (J, θ)
148
148
jacobian! (cons_oop, J, prep_jac, adtype, θ)
149
149
if size (J, 1 ) == 1
@@ -157,7 +157,7 @@ function OptimizationBase.instantiate_function(
157
157
end
158
158
159
159
if f. cons_vjp === nothing && cons_vjp == true && cons != = nothing
160
- prep_pullback = prepare_pullback (cons_oop, adtype, x, (ones (eltype (x), num_cons),))
160
+ prep_pullback = prepare_pullback (cons_oop, adtype, x, (ones (eltype (x), num_cons),), strict = Val ( false ) )
161
161
function cons_vjp! (J, θ, v)
162
162
pullback! (cons_oop, (J,), prep_pullback, adtype, θ, (v,))
163
163
end
@@ -169,7 +169,7 @@ function OptimizationBase.instantiate_function(
169
169
170
170
if cons != = nothing && f. cons_jvp === nothing && cons_jvp == true
171
171
prep_pushforward = prepare_pushforward (
172
- cons_oop, adtype, x, (ones (eltype (x), length (x)),))
172
+ cons_oop, adtype, x, (ones (eltype (x), length (x)),), strict = Val ( false ) )
173
173
function cons_jvp! (J, θ, v)
174
174
pushforward! (cons_oop, (J,), prep_pushforward, adtype, θ, (v,))
175
175
end
@@ -182,7 +182,7 @@ function OptimizationBase.instantiate_function(
182
182
conshess_sparsity = f. cons_hess_prototype
183
183
conshess_colors = f. cons_hess_colorvec
184
184
if cons != = nothing && cons_h == true && f. cons_h === nothing
185
- prep_cons_hess = [prepare_hessian (cons_oop, soadtype, x, Constant (i))
185
+ prep_cons_hess = [prepare_hessian (cons_oop, soadtype, x, Constant (i), strict = Val ( false ) )
186
186
for i in 1 : num_cons]
187
187
188
188
function cons_h! (H, θ)
@@ -201,7 +201,7 @@ function OptimizationBase.instantiate_function(
201
201
if f. lag_h === nothing && cons != = nothing && lag_h == true
202
202
lag_extras = prepare_hessian (
203
203
lagrangian, soadtype, x, Constant (one (eltype (x))),
204
- Constant (ones (eltype (x), num_cons)), Constant (p))
204
+ Constant (ones (eltype (x), num_cons)), Constant (p), strict = Val ( false ) )
205
205
lag_hess_prototype = zeros (Bool, num_cons, length (x))
206
206
207
207
function lag_h! (H:: AbstractMatrix , θ, σ, λ)
@@ -294,7 +294,7 @@ function OptimizationBase.instantiate_function(
294
294
adtype, soadtype = OptimizationBase. generate_sparse_adtype (adtype)
295
295
296
296
if g == true && f. grad === nothing
297
- extras_grad = prepare_gradient (f. f, adtype. dense_ad, x, Constant (p))
297
+ extras_grad = prepare_gradient (f. f, adtype. dense_ad, x, Constant (p), strict = Val ( false ) )
298
298
function grad (res, θ)
299
299
gradient! (f. f, res, extras_grad, adtype. dense_ad, θ, Constant (p))
300
300
end
@@ -311,7 +311,7 @@ function OptimizationBase.instantiate_function(
311
311
312
312
if fg == true && f. fg === nothing
313
313
if g == false
314
- extras_grad = prepare_gradient (f. f, adtype. dense_ad, x, Constant (p))
314
+ extras_grad = prepare_gradient (f. f, adtype. dense_ad, x, Constant (p), strict = Val ( false ) )
315
315
end
316
316
function fg! (res, θ)
317
317
(y, _) = value_and_gradient! (
@@ -334,7 +334,7 @@ function OptimizationBase.instantiate_function(
334
334
hess_sparsity = f. hess_prototype
335
335
hess_colors = f. hess_colorvec
336
336
if h == true && f. hess === nothing
337
- prep_hess = prepare_hessian (f. f, soadtype, x, Constant (p))
337
+ prep_hess = prepare_hessian (f. f, soadtype, x, Constant (p), strict = Val ( false ) )
338
338
function hess (res, θ)
339
339
hessian! (f. f, res, prep_hess, soadtype, θ, Constant (p))
340
340
end
@@ -458,7 +458,7 @@ function OptimizationBase.instantiate_function(
458
458
conshess_sparsity = f. cons_hess_prototype
459
459
conshess_colors = f. cons_hess_colorvec
460
460
if cons != = nothing && f. cons_h === nothing && cons_h == true
461
- prep_cons_hess = [prepare_hessian (cons_oop, soadtype, x, Constant (i))
461
+ prep_cons_hess = [prepare_hessian (cons_oop, soadtype, x, Constant (i), strict = Val ( false ) )
462
462
for i in 1 : num_cons]
463
463
colores = getfield .(prep_cons_hess, :coloring_result )
464
464
conshess_sparsity = getfield .(colores, :A )
@@ -479,7 +479,7 @@ function OptimizationBase.instantiate_function(
479
479
if cons != = nothing && f. lag_h === nothing && lag_h == true
480
480
lag_extras = prepare_hessian (
481
481
lagrangian, soadtype, x, Constant (one (eltype (x))),
482
- Constant (ones (eltype (x), num_cons)), Constant (p))
482
+ Constant (ones (eltype (x), num_cons)), Constant (p), strict = Val ( false ) )
483
483
lag_hess_prototype = lag_extras. coloring_result. A
484
484
lag_hess_colors = lag_extras. coloring_result. color
485
485
0 commit comments