2020mode (:: AutoChainRules ) = ForwardOrReverseMode () # specialized in the extension
2121
2222function Base. show (io:: IO , backend:: AutoChainRules )
23- print (io, AutoChainRules, " (ruleconfig=" , repr (backend. ruleconfig; context = io), " )" )
23+ return print (io, AutoChainRules, " (ruleconfig=" , repr (backend. ruleconfig; context = io), " )" )
2424end
2525
2626"""
@@ -68,7 +68,8 @@ struct AutoEnzyme{M, A} <: AbstractADType
6868end
6969
7070function AutoEnzyme (;
71- mode:: M = nothing , function_annotation:: Type{A} = Nothing) where {M, A}
71+ mode:: M = nothing , function_annotation:: Type{A} = Nothing
72+ ) where {M, A}
7273 return AutoEnzyme {M, A} (mode)
7374end
7475
@@ -79,7 +80,7 @@ function Base.show(io::IO, backend::AutoEnzyme{M, A}) where {M, A}
7980 ! isnothing (backend. mode) && print (io, " mode=" , repr (backend. mode; context = io))
8081 ! isnothing (backend. mode) && ! (A <: Nothing ) && print (io, " , " )
8182 ! (A <: Nothing ) && print (io, " function_annotation=" , repr (A; context = io))
82- print (io, " )" )
83+ return print (io, " )" )
8384end
8485
8586
@@ -101,12 +102,13 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
101102 + an [`AutoEnzyme`](@ref) object if a specific mode is required
102103 + `nothing` to choose the best mode automatically
103104"""
104- struct AutoReactant{M<: AutoEnzyme } <: AbstractADType
105+ struct AutoReactant{M <: AutoEnzyme } <: AbstractADType
105106 mode:: M
106107end
107108
108109function AutoReactant (;
109- mode:: Union{AutoEnzyme,Nothing} = nothing )
110+ mode:: Union{AutoEnzyme, Nothing} = nothing
111+ )
110112 if mode === nothing
111113 mode = AutoEnzyme ()
112114 end
@@ -118,7 +120,7 @@ mode(r::AutoReactant) = mode(r.mode)
118120function Base. show (io:: IO , backend:: AutoReactant )
119121 print (io, AutoReactant, " (" )
120122 print (io, " mode=" , repr (backend. mode; context = io))
121- print (io, " )" )
123+ return print (io, " )" )
122124end
123125
124126"""
@@ -184,7 +186,7 @@ function Base.show(io::IO, backend::AutoFiniteDiff)
184186 print (io, " absstep=" , repr (backend. absstep; context = io), " , " )
185187 backend. dir != true &&
186188 print (io, " dir=" , repr (backend. dir; context = io))
187- print (io, " )" )
189+ return print (io, " )" )
188190end
189191
190192"""
209211mode (:: AutoFiniteDifferences ) = ForwardMode ()
210212
211213function Base. show (io:: IO , backend:: AutoFiniteDifferences )
212- print (io, AutoFiniteDifferences, " (fdm=" , repr (backend. fdm; context = io), " )" )
214+ return print (io, AutoFiniteDifferences, " (fdm=" , repr (backend. fdm; context = io), " )" )
213215end
214216
215217"""
@@ -245,10 +247,12 @@ mode(::AutoForwardDiff) = ForwardMode()
245247
246248function Base. show (io:: IO , backend:: AutoForwardDiff{chunksize} ) where {chunksize}
247249 print (io, AutoForwardDiff, " (" )
248- chunksize != = nothing && print (io, " chunksize=" , repr (chunksize; context = io),
249- (backend. tag != = nothing ? " , " : " " ))
250+ chunksize != = nothing && print (
251+ io, " chunksize=" , repr (chunksize; context = io),
252+ (backend. tag != = nothing ? " , " : " " )
253+ )
250254 backend. tag != = nothing && print (io, " tag=" , repr (backend. tag; context = io))
251- print (io, " )" )
255+ return print (io, " )" )
252256end
253257
254258"""
@@ -277,7 +281,7 @@ mode(::AutoTaylorDiff) = ForwardMode()
277281function Base. show (io:: IO , :: AutoTaylorDiff{order} ) where {order}
278282 print (io, AutoTaylorDiff, " (" )
279283 print (io, " order=" , repr (order; context = io))
280- print (io, " )" )
284+ return print (io, " )" )
281285end
282286
283287"""
@@ -309,7 +313,7 @@ mode(::AutoGTPSA) = ForwardMode()
309313function Base. show (io:: IO , backend:: AutoGTPSA{D} ) where {D}
310314 print (io, AutoGTPSA, " (" )
311315 D != Nothing && print (io, " descriptor=" , repr (backend. descriptor; context = io))
312- print (io, " )" )
316+ return print (io, " )" )
313317end
314318
315319"""
@@ -343,7 +347,7 @@ function Base.show(io::IO, backend::AutoMooncake)
343347 print (io, AutoMooncake, " (" )
344348 backend. config != = nothing &&
345349 print (io, " config=" , repr (backend. config; context = io))
346- print (io, " )" )
350+ return print (io, " )" )
347351end
348352
349353"""
@@ -377,7 +381,7 @@ function Base.show(io::IO, backend::AutoMooncakeForward)
377381 print (io, AutoMooncakeForward, " (" )
378382 backend. config != = nothing &&
379383 print (io, " config=" , repr (backend. config; context = io))
380- print (io, " )" )
384+ return print (io, " )" )
381385end
382386
383387"""
@@ -415,10 +419,12 @@ mode(::AutoPolyesterForwardDiff) = ForwardMode()
415419
416420function Base. show (io:: IO , backend:: AutoPolyesterForwardDiff{chunksize} ) where {chunksize}
417421 print (io, AutoPolyesterForwardDiff, " (" )
418- chunksize != = nothing && print (io, " chunksize=" , repr (chunksize; context = io),
419- (backend. tag != = nothing ? " , " : " " ))
422+ chunksize != = nothing && print (
423+ io, " chunksize=" , repr (chunksize; context = io),
424+ (backend. tag != = nothing ? " , " : " " )
425+ )
420426 backend. tag != = nothing && print (io, " tag=" , repr (backend. tag; context = io))
421- print (io, " )" )
427+ return print (io, " )" )
422428end
423429
424430"""
@@ -466,7 +472,8 @@ function Base.getproperty(ad::AutoReverseDiff, s::Symbol)
466472 if s === :compile
467473 Base. depwarn (
468474 " `ad.compile` where `ad` is `AutoReverseDiff` has been deprecated and will be removed in v2. Instead it is available as a compile-time constant as `AutoReverseDiff{true}` or `AutoReverseDiff{false}`." ,
469- :getproperty )
475+ :getproperty
476+ )
470477 end
471478 return getfield (ad, s)
472479end
@@ -476,7 +483,7 @@ mode(::AutoReverseDiff) = ReverseMode()
476483function Base. show (io:: IO , :: AutoReverseDiff{compile} ) where {compile}
477484 print (io, AutoReverseDiff, " (" )
478485 compile && print (io, " compile=true" )
479- print (io, " )" )
486+ return print (io, " )" )
480487end
481488
482489"""
@@ -522,7 +529,7 @@ mode(::AutoTapir) = ReverseMode()
522529function Base. show (io:: IO , backend:: AutoTapir )
523530 print (io, AutoTapir, " (" )
524531 ! (backend. safe_mode) && print (io, " safe_mode=false" )
525- print (io, " )" )
532+ return print (io, " )" )
526533end
527534
528535"""
0 commit comments