Skip to content

Commit cc3ebb7

Browse files
committed
address review
1 parent f68678a commit cc3ebb7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/algorithms/trust_region.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ function TrustRegion(; concrete_jac = nothing, linsolve = nothing, precs = DEFAU
2424
initial_trust_radius::Real = 0 // 1, step_threshold::Real = 1 // 10000,
2525
shrink_threshold::Real = 1 // 4, expand_threshold::Real = 3 // 4,
2626
shrink_factor::Real = 1 // 4, expand_factor::Real = 2 // 1,
27-
max_shrink_times::Int = 32, autodiff = nothing, vjp_autodiff = autodiff)
27+
max_shrink_times::Int = 32, autodiff = nothing, vjp_autodiff = nothing)
2828
descent = Dogleg(; linsolve, precs)
2929
if autodiff isa Union{ADTypes.AbstractForwardMode, ADTypes.AbstractFiniteDifferencesMode}
3030
forward_ad = autodiff
3131
else
3232
forward_ad = nothing
3333
end
34+
if isnothing(vjp_autodiff) && autodiff isa ADTypes.AbstractFiniteDifferencesMode
35+
vjp_autodiff = autodiff
36+
end
3437
trustregion = GenericTrustRegionScheme(; method = radius_update_scheme, step_threshold,
3538
shrink_threshold, expand_threshold, shrink_factor, expand_factor,
3639
reverse_ad = vjp_autodiff, forward_ad)

0 commit comments

Comments
 (0)