@@ -6,17 +6,19 @@ struct ForwardDiffJacobianCache{CO, CA, J, FX, X} <: AbstractMaybeSparseJacobian
6
6
x:: X
7
7
end
8
8
9
+ struct SparseDiffToolsTag end
10
+
9
11
function sparse_jacobian_cache (ad:: Union{AutoSparseForwardDiff, AutoForwardDiff} ,
10
12
sd:: AbstractMaybeSparsityDetection , f, x; fx = nothing )
11
13
coloring_result = sd (ad, f, x)
12
14
fx = fx === nothing ? similar (f (x)) : fx
13
15
if coloring_result isa NoMatrixColoring
14
- cache = ForwardDiff. JacobianConfig (f, x)
16
+ cache = ForwardDiff. JacobianConfig (f, x, __chunksize (ad, x),
17
+ ifelse (ad. tag === nothing , SparseDiffToolsTag (), ad. tag))
15
18
jac_prototype = nothing
16
19
else
17
20
cache = ForwardColorJacCache (f, x, __chunksize (ad); coloring_result. colorvec,
18
- dx = fx,
19
- sparsity = coloring_result. jacobian_sparsity)
21
+ dx = fx, sparsity = coloring_result. jacobian_sparsity, ad. tag)
20
22
jac_prototype = coloring_result. jacobian_sparsity
21
23
end
22
24
return ForwardDiffJacobianCache (coloring_result, cache, jac_prototype, fx, x)
@@ -26,11 +28,12 @@ function sparse_jacobian_cache(ad::Union{AutoSparseForwardDiff, AutoForwardDiff}
26
28
sd:: AbstractMaybeSparsityDetection , f!, fx, x)
27
29
coloring_result = sd (ad, f!, fx, x)
28
30
if coloring_result isa NoMatrixColoring
29
- cache = ForwardDiff. JacobianConfig (f!, fx, x)
31
+ cache = ForwardDiff. JacobianConfig (f!, fx, x, __chunksize (ad, x),
32
+ ifelse (ad. tag === nothing , SparseDiffToolsTag (), ad. tag))
30
33
jac_prototype = nothing
31
34
else
32
35
cache = ForwardColorJacCache (f!, x, __chunksize (ad); coloring_result. colorvec,
33
- dx = fx, sparsity = coloring_result. jacobian_sparsity)
36
+ dx = fx, sparsity = coloring_result. jacobian_sparsity, ad . tag )
34
37
jac_prototype = coloring_result. jacobian_sparsity
35
38
end
36
39
return ForwardDiffJacobianCache (coloring_result, cache, jac_prototype, fx, x)
0 commit comments