@@ -31,7 +31,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing;
3131 end
3232
3333 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)... )
3535
3636 if dx isa Nothing
3737 fx = similar (t)
@@ -43,7 +43,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing;
4343 else
4444 pi = pi [1 : length (dx)]
4545 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)... )
4747 _dx = dx
4848 end
4949
@@ -99,7 +99,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
9999
100100 for i in eachindex (p)
101101 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))
103103 fx = f (t)
104104 if ! (sparsity isa Nothing)
105105 for j in 1 : chunksize
@@ -169,7 +169,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
169169
170170 for i in eachindex (p)
171171 partial_i = p[i]
172- vect .= Dual {typeof(f )} .(vecx, partial_i)
172+ vect .= Dual {ForwardDiff.Tag(f,eltype(vecx) )} .(vecx, partial_i)
173173 f (fx,t)
174174 if ! (sparsity isa Nothing)
175175 for j in 1 : chunksize
0 commit comments