Skip to content

Commit 385deb3

Browse files
Always convert for thready safety
1 parent 45eec78 commit 385deb3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/function/function.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ function instantiate_function(f, x, ::AbstractADType, p, num_cons = 0)
5050
cons = f.cons === nothing ? nothing : (x)->f.cons(x,p)
5151
cons_j = f.cons_j === nothing ? nothing : (res,x)->f.cons_j(res,x,p)
5252
cons_h = f.cons_h === nothing ? nothing : (res,x)->f.cons_h(res,x,p)
53-
hess_prototype = f.hess_prototype === nothing ? nothing : (!(eltype(f.hess_prototype) == eltype(x)) ? convert.(eltype(x), f.hess_prototype) : f.hess_prototype)
54-
cons_jac_prototype = f.cons_jac_prototype === nothing ? nothing : (!(eltype(f.cons_jac_prototype) == eltype(x)) ? convert.(eltype(x), f.cons_jac_prototype) : f.cons_jac_prototype)
55-
cons_hess_prototype = f.cons_hess_prototype === nothing ? nothing : (!(eltype(f.cons_hess_prototype) == eltype(x)) ? convert.(eltype(x), f.cons_hess_prototype) : f.cons_hess_prototype)
53+
hess_prototype = f.hess_prototype === nothing ? nothing : convert.(eltype(x), f.hess_prototype)
54+
cons_jac_prototype = f.cons_jac_prototype === nothing ? nothing : convert.(eltype(x), f.cons_jac_prototype)
55+
cons_hess_prototype = f.cons_hess_prototype === nothing ? nothing : convert.(eltype(x), f.cons_hess_prototype)
5656
expr = symbolify(f.expr)
5757
cons_expr = symbolify.(f.cons_expr)
5858

0 commit comments

Comments
 (0)