This repository was archived by the owner on Aug 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,19 @@ function OptimizationCache(prob::SciMLBase.OptimizationProblem, opt;
42
42
43
43
num_cons = prob. ucons === nothing ? 0 : length (prob. ucons)
44
44
45
- if ! (prob. f. adtype isa DifferentiationInterface. SecondOrder) &&
45
+ if ! (prob. f. adtype isa DifferentiationInterface. SecondOrder ||
46
+ prob. f. adtype isa AutoZygote) &&
46
47
(SciMLBase. requireshessian (opt) || SciMLBase. requiresconshess (opt) ||
47
48
SciMLBase. requireslagh (opt))
48
49
@warn " The selected optimization algorithm requires second order derivatives, but `SecondOrder` ADtype was not provided.
49
50
So a `SecondOrder` with $(prob. f. adtype) for both inner and outer will be created, this can be suboptimal and not work in some cases so
50
51
an explicit `SecondOrder` ADtype is recommended."
52
+ elseif prob. f. adtype isa AutoZygote &&
53
+ (SciMLBase. requiresconshess (opt) || SciMLBase. requireslagh (opt) ||
54
+ SciMLBase. requireshessian (opt))
55
+ @warn " The selected optimization algorithm requires second order derivatives, but `AutoZygote` ADtype was provided.
56
+ So a `SecondOrder` with `AutoZygote` for inner and `AutoForwardDiff` for outer will be created, for choosing another pair
57
+ an explicit `SecondOrder` ADtype is recommended."
51
58
end
52
59
53
60
f = OptimizationBase. instantiate_function (
You can’t perform that action at this time.
0 commit comments