Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit f4954e7

Browse files
Fix Dual tag nesting
1 parent a87658a commit f4954e7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/differentiation/compute_jacobian_ad.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing;
3232
end
3333

3434
p = adapt.(parameterless_type(x),generate_chunked_partials(x,colorvec,chunksize))
35-
_t = Dual{ForwardDiff.Tag(f,eltype(vec(x)))}.(vec(x),first(p))
35+
_t = Dual{typeof(ForwardDiff.Tag(f,eltype(vec(x))))}.(vec(x),first(p))
3636
t = ArrayInterface.restructure(x,_t)
3737
if dx isa Nothing
3838
fx = similar(t)
@@ -97,7 +97,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
9797

9898
for i in eachindex(p)
9999
partial_i = p[i]
100-
t = reshape(Dual{ForwardDiff.Tag(f,eltype(vecx))}.(vecx, partial_i),size(t))
100+
t = reshape(Dual{typeof(ForwardDiff.Tag(f,eltype(vecx)))}.(vecx, partial_i),size(t))
101101
fx = f(t)
102102
if !(sparsity isa Nothing)
103103
for j in 1:chunksize
@@ -171,7 +171,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
171171

172172
for i in eachindex(p)
173173
partial_i = p[i]
174-
vect .= Dual{ForwardDiff.Tag(f,eltype(vecx))}.(vecx, partial_i)
174+
vect .= Dual{typeof(ForwardDiff.Tag(f,eltype(vecx)))}.(vecx, partial_i)
175175
f(fx,t)
176176
if !(sparsity isa Nothing)
177177
for j in 1:chunksize

0 commit comments

Comments
 (0)