Skip to content

Commit f3b317d

Browse files
committed
fix: mode warning printing
1 parent 5073358 commit f3b317d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/NonlinearSolveBase/src/autodiff.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const ForwardADs = (
3333

3434
function select_forward_mode_autodiff(
3535
prob::AbstractNonlinearProblem, ad::AbstractADType; warn_check_mode::Bool = true)
36-
if warn_check_mode && !(ADTypes.mode(ad) isa ADTypes.ForwardMode)
36+
if warn_check_mode && !(ADTypes.mode(ad) isa ADTypes.ForwardMode) &&
37+
!(ADTypes.mode(ad) isa ADTypes.ForwardOrReverseMode)
3738
@warn "The chosen AD backend $(ad) is not a forward mode AD. Use with caution."
3839
end
3940
if incompatible_backend_and_problem(prob, ad)
@@ -58,7 +59,8 @@ end
5859

5960
function select_reverse_mode_autodiff(
6061
prob::AbstractNonlinearProblem, ad::AbstractADType; warn_check_mode::Bool = true)
61-
if warn_check_mode && !(ADTypes.mode(ad) isa ADTypes.ReverseMode)
62+
if warn_check_mode && !(ADTypes.mode(ad) isa ADTypes.ReverseMode) &&
63+
!(ADTypes.mode(ad) isa ADTypes.ForwardOrReverseMode)
6264
if !is_finite_differences_backend(ad)
6365
@warn "The chosen AD backend $(ad) is not a reverse mode AD. Use with caution."
6466
else

0 commit comments

Comments
 (0)