|
20 | 20 | mode(::AutoChainRules) = ForwardOrReverseMode() # specialized in the extension |
21 | 21 |
|
22 | 22 | function Base.show(io::IO, backend::AutoChainRules) |
23 | | - print(io, "AutoChainRules(ruleconfig=$(repr(backend.ruleconfig, context=io)))") |
| 23 | + print(io, AutoChainRules, "(ruleconfig=", repr(backend.ruleconfig; context = io), ")") |
24 | 24 | end |
25 | 25 |
|
26 | 26 | """ |
|
63 | 63 | mode(::AutoEnzyme) = ForwardOrReverseMode() # specialized in the extension |
64 | 64 |
|
65 | 65 | function Base.show(io::IO, backend::AutoEnzyme) |
66 | | - if isnothing(backend.mode) |
67 | | - print(io, "AutoEnzyme()") |
68 | | - else |
69 | | - print(io, "AutoEnzyme(mode=$(repr(backend.mode, context=io)))") |
70 | | - end |
| 66 | + print(io, AutoEnzyme, "(") |
| 67 | + !isnothing(backend.mode) && print(io, "mode=", repr(backend.mode; context = io)) |
| 68 | + print(io, ")") |
71 | 69 | end |
72 | 70 |
|
73 | 71 | """ |
@@ -111,21 +109,14 @@ end |
111 | 109 | mode(::AutoFiniteDiff) = ForwardMode() |
112 | 110 |
|
113 | 111 | function Base.show(io::IO, backend::AutoFiniteDiff) |
114 | | - s = "AutoFiniteDiff(" |
115 | | - if backend.fdtype != Val(:forward) |
116 | | - s *= "fdtype=$(repr(backend.fdtype, context=io)), " |
117 | | - end |
118 | | - if backend.fdjtype != backend.fdtype |
119 | | - s *= "fdjtype=$(repr(backend.fdjtype, context=io)), " |
120 | | - end |
121 | | - if backend.fdhtype != Val(:hcentral) |
122 | | - s *= "fdhtype=$(repr(backend.fdhtype, context=io)), " |
123 | | - end |
124 | | - if endswith(s, ", ") |
125 | | - s = s[1:(end - 2)] |
126 | | - end |
127 | | - s *= ")" |
128 | | - print(io, s) |
| 112 | + print(io, AutoFiniteDiff, "(") |
| 113 | + backend.fdtype != Val(:forward) && |
| 114 | + print(io, "fdtype=", repr(backend.fdtype; context = io), ", ") |
| 115 | + backend.fdjtype != backend.fdtype && |
| 116 | + print(io, "fdjtype=", repr(backend.fdjtype; context = io), ", ") |
| 117 | + backend.fdhtype != Val(:hcentral) && |
| 118 | + print(io, "fdhtype=", repr(backend.fdhtype; context = io)) |
| 119 | + print(io, ")") |
129 | 120 | end |
130 | 121 |
|
131 | 122 | """ |
|
150 | 141 | mode(::AutoFiniteDifferences) = ForwardMode() |
151 | 142 |
|
152 | 143 | function Base.show(io::IO, backend::AutoFiniteDifferences) |
153 | | - print(io, "AutoFiniteDifferences(fdm=$(repr(backend.fdm, context=io)))") |
| 144 | + print(io, AutoFiniteDifferences, "(fdm=", repr(backend.fdm; context = io), ")") |
154 | 145 | end |
155 | 146 |
|
156 | 147 | """ |
@@ -183,18 +174,11 @@ end |
183 | 174 | mode(::AutoForwardDiff) = ForwardMode() |
184 | 175 |
|
185 | 176 | function Base.show(io::IO, backend::AutoForwardDiff{chunksize}) where {chunksize} |
186 | | - s = "AutoForwardDiff(" |
187 | | - if chunksize !== nothing |
188 | | - s *= "chunksize=$chunksize, " |
189 | | - end |
190 | | - if backend.tag !== nothing |
191 | | - s *= "tag=$(repr(backend.tag, context=io)), " |
192 | | - end |
193 | | - if endswith(s, ", ") |
194 | | - s = s[1:(end - 2)] |
195 | | - end |
196 | | - s *= ")" |
197 | | - print(io, s) |
| 177 | + print(io, AutoForwardDiff, "(") |
| 178 | + chunksize !== nothing && print(io, "chunksize=", repr(chunksize; context = io), |
| 179 | + (backend.tag !== nothing ? ", " : "")) |
| 180 | + backend.tag !== nothing && print(io, "tag=", repr(backend.tag; context = io)) |
| 181 | + print(io, ")") |
198 | 182 | end |
199 | 183 |
|
200 | 184 | """ |
@@ -227,18 +211,11 @@ end |
227 | 211 | mode(::AutoPolyesterForwardDiff) = ForwardMode() |
228 | 212 |
|
229 | 213 | function Base.show(io::IO, backend::AutoPolyesterForwardDiff{chunksize}) where {chunksize} |
230 | | - s = "AutoPolyesterForwardDiff(" |
231 | | - if chunksize !== nothing |
232 | | - s *= "chunksize=$chunksize, " |
233 | | - end |
234 | | - if backend.tag !== nothing |
235 | | - s *= "tag=$(repr(backend.tag, context=io)), " |
236 | | - end |
237 | | - if endswith(s, ", ") |
238 | | - s = s[1:(end - 2)] |
239 | | - end |
240 | | - s *= ")" |
241 | | - print(io, s) |
| 214 | + print(io, AutoPolyesterForwardDiff, "(") |
| 215 | + chunksize !== nothing && print(io, "chunksize=", repr(chunksize; context = io), |
| 216 | + (backend.tag !== nothing ? ", " : "")) |
| 217 | + backend.tag !== nothing && print(io, "tag=", repr(backend.tag; context = io)) |
| 218 | + print(io, ")") |
242 | 219 | end |
243 | 220 |
|
244 | 221 | """ |
|
277 | 254 | mode(::AutoReverseDiff) = ReverseMode() |
278 | 255 |
|
279 | 256 | function Base.show(io::IO, ::AutoReverseDiff{compile}) where {compile} |
280 | | - if !compile |
281 | | - print(io, "AutoReverseDiff()") |
282 | | - else |
283 | | - print(io, "AutoReverseDiff(compile=true)") |
284 | | - end |
| 257 | + print(io, AutoReverseDiff, "(") |
| 258 | + compile && print(io, "compile=true") |
| 259 | + print(io, ")") |
285 | 260 | end |
286 | 261 |
|
287 | 262 | """ |
|
321 | 296 | mode(::AutoTapir) = ReverseMode() |
322 | 297 |
|
323 | 298 | function Base.show(io::IO, backend::AutoTapir) |
324 | | - if backend.safe_mode |
325 | | - print(io, "AutoTapir()") |
326 | | - else |
327 | | - print(io, "AutoTapir(safe_mode=false)") |
328 | | - end |
| 299 | + print(io, AutoTapir, "(") |
| 300 | + !(backend.safe_mode) && print(io, "safe_mode=false") |
| 301 | + print(io, ")") |
329 | 302 | end |
330 | 303 |
|
331 | 304 | """ |
|
0 commit comments