You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ext/OptimizationDIExt.jl
+25-9Lines changed: 25 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ using ADTypes
10
10
11
11
function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, x, adtype::ADTypes.AbstractADType, p = SciMLBase.NullParameters(), num_cons =0)
@@ -144,6 +147,9 @@ function OptimizationBase.instantiate_function(f::OptimizationFunction{true}, ca
144
147
extras_jac =prepare_jacobian(cons_oop, adtype, x)
145
148
cons_j =function (J, θ)
146
149
jacobian!(cons_oop, J, adtype, θ, extras_jac)
150
+
ifsize(J, 1) ==1
151
+
J =vec(J)
152
+
end
147
153
end
148
154
else
149
155
cons_j = (J, θ) -> f.cons_j(J, θ, p)
@@ -183,7 +189,7 @@ end
183
189
184
190
function OptimizationBase.instantiate_function(f::OptimizationFunction{false}, x, adtype::ADTypes.AbstractADType, p = SciMLBase.NullParameters(), num_cons =0)
0 commit comments