Skip to content

Commit 456517a

Browse files
Merge pull request #101 from JuliaDiff/restructure
use ArrayInterface.restructure
2 parents 113beba + 8d40cd0 commit 456517a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
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 <[email protected]>", "Chris Rackauckas <[email protected]>"]
4-
version = "1.5.0"
4+
version = "1.6.0"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -19,7 +19,7 @@ VertexSafeGraphs = "19fa3120-7c27-5ec5-8db8-b0b0aa330d6f"
1919

2020
[compat]
2121
Adapt = "1"
22-
ArrayInterface = "2"
22+
ArrayInterface = "2.8"
2323
Compat = "2.2, 3"
2424
DataStructures = "0.17"
2525
FiniteDiff = "2"

src/differentiation/compute_jacobian_ad.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ 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,eltype(vec(x)))}.(vec(x),first(p)),size(x)...)
35-
34+
_t = Dual{ForwardDiff.Tag(f,eltype(vec(x)))}.(vec(x),first(p))
35+
t = ArrayInterface.restructure(x,_t)
3636
if dx isa Nothing
3737
fx = similar(t)
3838
_dx = similar(x)
3939
else
4040
tup = first(first(p)) .* false
41-
pi = adapt.(typeof(dx),[tup for i in 1:length(dx)])
42-
fx = reshape(Dual{ForwardDiff.Tag(f,eltype(vec(x)))}.(vec(dx),pi),size(dx)...)
41+
_pi = adapt.(typeof(dx),[tup for i in 1:length(dx)])
42+
fx = reshape(Dual{ForwardDiff.Tag(f,eltype(vec(x)))}.(vec(dx),_pi),size(dx)...)
4343
_dx = dx
4444
end
4545

0 commit comments

Comments
 (0)