@@ -134,7 +134,8 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x,
134
134
135
135
if cons != = nothing && f. cons_j === nothing
136
136
cons_j = function (J, θ, args... )
137
- return Enzyme. autodiff (Enzyme. Forward, cons_oop, BatchDuplicated (θ, (J[i, :] for i in 1 : num_cons)),
137
+ return Enzyme. autodiff (Enzyme. Forward, cons_oop,
138
+ BatchDuplicated (θ, Tuple (J[i, :] for i in 1 : num_cons)),
138
139
Const (f. cons), Const (p), Const .(args)... )
139
140
end
140
141
else
@@ -240,7 +241,8 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true},
240
241
241
242
if cons != = nothing && f. cons_j === nothing
242
243
cons_j = function (J, θ, args... )
243
- Enzyme. autodiff (Enzyme. Forward, cons_oop, BatchDuplicated (θ, (J[i, :] for i in 1 : num_cons)),
244
+ Enzyme. autodiff (Enzyme. Forward, cons_oop,
245
+ BatchDuplicated (θ, Tuple (J[i, :] for i in 1 : num_cons)),
244
246
Const (f. cons), Const (p), Const .(args)... )
245
247
end
246
248
else
@@ -347,7 +349,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{false}, x
347
349
348
350
if f. cons != = nothing && f. cons_j === nothing
349
351
cons_j = function (θ, args... )
350
- J = (zeros (eltype (θ), length (θ)) for i in 1 : num_cons)
352
+ J = Tuple (zeros (eltype (θ), length (θ)) for i in 1 : num_cons)
351
353
Enzyme. autodiff (
352
354
Enzyme. Forward, f. cons, BatchDuplicated (θ, J), Const (p), Const .(args)... )
353
355
return reduce (vcat, reshape .(J, Ref (1 ), Ref (length (θ))))
@@ -459,7 +461,7 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{false},
459
461
460
462
if f. cons != = nothing && f. cons_j === nothing
461
463
cons_j = function (θ, args... )
462
- J = (zeros (eltype (θ), length (θ)) for i in 1 : num_cons)
464
+ J = Tuple (zeros (eltype (θ), length (θ)) for i in 1 : num_cons)
463
465
Enzyme. autodiff (
464
466
Enzyme. Forward, f. cons, BatchDuplicated (θ, J), Const (p), Const .(args)... )
465
467
return reduce (vcat, reshape .(J, Ref (1 ), Ref (length (θ))))
0 commit comments