From df1340aabb8e7946cb75d3eb140c3c38f2745b6f Mon Sep 17 00:00:00 2001 From: jClugstor Date: Tue, 5 Nov 2024 17:12:31 -0500 Subject: [PATCH] fix bools --- lib/OrdinaryDiffEqCore/src/misc_utils.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/misc_utils.jl b/lib/OrdinaryDiffEqCore/src/misc_utils.jl index 027be53f95..91ad7daed1 100644 --- a/lib/OrdinaryDiffEqCore/src/misc_utils.jl +++ b/lib/OrdinaryDiffEqCore/src/misc_utils.jl @@ -134,18 +134,20 @@ isnewton(::Any) = false function _bool_to_ADType(::Val{true}, chunk_size, diff_type) Base.depwarn("Using a `Bool` for keyword argument `autodiff` is deprecated. Please use an `ADType` specifier.", :_bool_to_ADType) - AutoForwardDiff(chunk_size = SciMLBase._unwrap_val(chunksize)) + typeof(AutoForwardDiff(chunk_size = SciMLBase._unwrap_val(chunksize))) end function _bool_to_ADType(::Val{false}, chunk_size, diff_type) Base.depwarn("Using a `Bool` for keyword argument `autodiff` is deprecated. Please use an `ADType` specifier.", :_bool_to_ADType) - AutoFiniteDiff(fdtype = diff_type) + typeof(AutoFiniteDiff(fdtype = diff_type)) end # Functions to get ADType type from Bool or ADType object, or ADType type -_process_AD_choice(ad_alg::Bool, chunksize, diff_type) = _bool_to_ADType(ad_alg, chunksize, diff_type) +_process_AD_choice(ad_alg::Bool, chunksize, diff_type) = _bool_to_ADType(Val(ad_alg), chunksize, diff_type) + + +_process_AD_choice(ad_alg::Type{<:AbstractADType}, chunksize, diff_type) = ad_alg -_process_AD_choice(ad_alg::Type{<:AbstractADType}, chunksize, diff_type) = ad_alg _process_AD_choice(ad_alg::AbstractADType, chunksize, diff_type) = typeof(ad_alg)