@@ -6,13 +6,13 @@ get_tag(::Dual{T, V, N}) where {T, V, N} = T
66# J(f(x))*v
77function auto_jacvec! (dy, f, x, v,
88 cache1 = Dual{typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
9- eltype (x), 1 ,
9+ eltype (x), 1
1010 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x))))),
1111 cache2 = similar (cache1))
1212 cache1 .= Dual{
1313 get_tag (cache1),
1414 eltype (x),
15- 1 ,
15+ 1
1616 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x)))))
1717 f (cache2, cache1)
1818 vecdy = _vec (dy)
@@ -27,7 +27,7 @@ function auto_jacvec(f, x, v)
2727 y = ForwardDiff. Dual{
2828 typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
2929 eltype (x),
30- 1 ,
30+ 1
3131 }. (x, ForwardDiff. Partials .(tuple .(vv)))
3232 vec (partials .(vec (f (y)), 1 ))
3333end
@@ -113,17 +113,17 @@ end
113113
114114function autonum_hesvec! (dy, f, x, v,
115115 cache1 = Dual{typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
116- eltype (x), 1 ,
116+ eltype (x), 1
117117 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x))))),
118118 cache2 = Dual{typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
119- eltype (x), 1 ,
119+ eltype (x), 1
120120 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x))))))
121121 cache = FiniteDiff. GradientCache (v[1 ], cache1, Val{:central })
122122 g = (dx, x) -> FiniteDiff. finite_difference_gradient! (dx, f, x, cache)
123123 cache1 .= Dual{
124124 get_tag (cache1),
125125 eltype (x),
126- 1 ,
126+ 1
127127 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x)))))
128128 g (cache2, cache1)
129129 dy .= partials .(cache2, 1 )
@@ -159,15 +159,15 @@ end
159159
160160function auto_hesvecgrad! (dy, g, x, v,
161161 cache2 = Dual{typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
162- eltype (x), 1 ,
162+ eltype (x), 1
163163 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x))))),
164164 cache3 = Dual{typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
165- eltype (x), 1 ,
165+ eltype (x), 1
166166 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x))))))
167167 cache2 .= Dual{
168168 get_tag (cache2),
169169 eltype (x),
170- 1 ,
170+ 1
171171 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x)))))
172172 g (cache3, cache2)
173173 dy .= partials .(cache3, 1 )
@@ -177,7 +177,7 @@ function auto_hesvecgrad(g, x, v)
177177 y = Dual{
178178 typeof (ForwardDiff. Tag (DeivVecTag (), eltype (x))),
179179 eltype (x),
180- 1 ,
180+ 1
181181 }. (x, ForwardDiff. Partials .(tuple .(reshape (v, size (x)))))
182182 partials .(g (y), 1 )
183183end
@@ -272,10 +272,10 @@ function JacVec(f, u::AbstractArray, p = nothing, t = nothing; fu = nothing,
272272 (cache1, cache2), num_jacvec, num_jacvec!
273273 elseif autodiff isa AutoForwardDiff
274274 cache1 = Dual{
275- typeof (ForwardDiff. Tag (tag, eltype (u))), eltype (u), 1 ,
275+ typeof (ForwardDiff. Tag (tag, eltype (u))), eltype (u), 1
276276 }. (u, ForwardDiff. Partials .(tuple .(u)))
277277 cache2 = Dual{
278- typeof (ForwardDiff. Tag (tag, eltype (fu))), eltype (fu), 1 ,
278+ typeof (ForwardDiff. Tag (tag, eltype (fu))), eltype (fu), 1
279279 }. (fu, ForwardDiff. Partials .(tuple .(fu)))
280280
281281 (cache1, cache2), auto_jacvec, auto_jacvec!
@@ -307,7 +307,7 @@ function HesVec(f, u::AbstractArray, p = nothing, t = nothing;
307307 @assert static_hasmethod (autoback_hesvec, typeof ((f, u, u))) " To use AutoZygote() AD, first load Zygote with `using Zygote`, or `import Zygote`"
308308
309309 cache1 = Dual{
310- typeof (ForwardDiff. Tag (tag, eltype (u))), eltype (u), 1 ,
310+ typeof (ForwardDiff. Tag (tag, eltype (u))), eltype (u), 1
311311 }. (u, ForwardDiff. Partials .(tuple .(u)))
312312 cache2 = copy (cache1)
313313
@@ -338,7 +338,7 @@ function HesVecGrad(f, u::AbstractArray, p = nothing, t = nothing;
338338 (cache1, cache2), num_hesvecgrad, num_hesvecgrad!
339339 elseif autodiff isa AutoForwardDiff
340340 cache1 = Dual{
341- typeof (ForwardDiff. Tag (tag, eltype (u))), eltype (u), 1 ,
341+ typeof (ForwardDiff. Tag (tag, eltype (u))), eltype (u), 1
342342 }. (u, ForwardDiff. Partials .(tuple .(u)))
343343 cache2 = copy (cache1)
344344
0 commit comments