Skip to content

Commit 0ce29a2

Browse files
committed
Don't use custom tags
1 parent df8e05a commit 0ce29a2

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SparseDiffTools"
22
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
33
authors = ["Pankaj Mishra <pankajmishra1511@gmail.com>", "Chris Rackauckas <contact@chrisrackauckas.com>"]
4-
version = "2.17.0"
4+
version = "2.17.1"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/highlevel/forward_mode.jl

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,15 @@ end
88

99
__getfield(c::ForwardDiffJacobianCache, ::Val{:jac_prototype}) = c.jac_prototype
1010

11-
struct SparseDiffToolsTag end
12-
13-
function ForwardDiff.checktag(::Type{<:ForwardDiff.Tag{<:SparseDiffToolsTag, <:T}}, f::F,
14-
x::AbstractArray{T}) where {T, F}
15-
return true
16-
end
17-
18-
__standard_tag(::Nothing, x) = ForwardDiff.Tag(SparseDiffToolsTag(), eltype(x))
19-
__standard_tag(tag::ForwardDiff.Tag, _) = tag
20-
__standard_tag(tag, x) = ForwardDiff.Tag(tag, eltype(x))
11+
__standard_tag(::Nothing, f::F, x) where {F} = ForwardDiff.Tag(f, eltype(x))
12+
__standard_tag(tag::ForwardDiff.Tag, ::F, _) where {F} = tag
13+
__standard_tag(tag, f::F, x) where {F} = ForwardDiff.Tag(f, eltype(x))
2114

2215
function sparse_jacobian_cache(ad::Union{AutoSparseForwardDiff, AutoForwardDiff},
2316
sd::AbstractMaybeSparsityDetection, f::F, x; fx = nothing) where {F}
2417
coloring_result = sd(ad, f, x)
2518
fx = fx === nothing ? similar(f(x)) : fx
26-
tag = __standard_tag(ad.tag, x)
19+
tag = __standard_tag(ad.tag, f, x)
2720
if coloring_result isa NoMatrixColoring
2821
cache = ForwardDiff.JacobianConfig(f, x, __chunksize(ad, x), tag)
2922
jac_prototype = nothing
@@ -39,7 +32,7 @@ end
3932
function sparse_jacobian_cache(ad::Union{AutoSparseForwardDiff, AutoForwardDiff},
4033
sd::AbstractMaybeSparsityDetection, f!::F, fx, x) where {F}
4134
coloring_result = sd(ad, f!, fx, x)
42-
tag = __standard_tag(ad.tag, x)
35+
tag = __standard_tag(ad.tag, f!, x)
4336
if coloring_result isa NoMatrixColoring
4437
cache = ForwardDiff.JacobianConfig(f!, fx, x, __chunksize(ad, x), tag)
4538
jac_prototype = nothing

0 commit comments

Comments
 (0)