@@ -31,7 +31,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing;
31
31
end
32
32
33
33
p = adapt .(typeof (x),generate_chunked_partials (x,colorvec,chunksize))
34
- t = reshape (Dual {ForwardDiff.Tag(f,vec(x)} .(vec (x),first (p)),size (x)... )
34
+ t = reshape (Dual {ForwardDiff.Tag(f,eltype( vec(x)) )} .(vec (x),first (p)),size (x)... )
35
35
36
36
if dx isa Nothing
37
37
fx = similar (t)
@@ -43,7 +43,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing;
43
43
else
44
44
pi = pi [1 : length (dx)]
45
45
end
46
- fx = reshape (Dual {typeof(f )} .(vec (dx),pi ),size (dx)... )
46
+ fx = reshape (Dual {ForwardDiff.Tag(f,eltype(vec(x)) )} .(vec (dx),pi ),size (dx)... )
47
47
_dx = dx
48
48
end
49
49
@@ -99,7 +99,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
99
99
100
100
for i in eachindex (p)
101
101
partial_i = p[i]
102
- t = reshape (Dual {typeof(f )} .(vecx, partial_i),size (t))
102
+ t = reshape (Dual {ForwardDiff.Tag(f,eltype(vecx) )} .(vecx, partial_i),size (t))
103
103
fx = f (t)
104
104
if ! (sparsity isa Nothing)
105
105
for j in 1 : chunksize
@@ -169,7 +169,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
169
169
170
170
for i in eachindex (p)
171
171
partial_i = p[i]
172
- vect .= Dual {typeof(f )} .(vecx, partial_i)
172
+ vect .= Dual {ForwardDiff.Tag(f,eltype(vecx) )} .(vecx, partial_i)
173
173
f (fx,t)
174
174
if ! (sparsity isa Nothing)
175
175
for j in 1 : chunksize
0 commit comments