Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 1a5f533

Browse files
committed
Change Tuple -> tuple for consistency
1 parent d536c70 commit 1a5f533

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

ext/SparseDiffToolsZygote.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,24 @@ function SparseDiffTools.autoback_hesvec!(dy, f, x, v,
4444
cache1 = Dual{typeof(ForwardDiff.Tag(DeivVecTag(), eltype(x))),
4545
eltype(x), 1
4646
}.(x,
47-
ForwardDiff.Partials.(Tuple.(reshape(v, size(x))))),
47+
ForwardDiff.Partials.(tuple.(reshape(v, size(x))))),
4848
cache2 = Dual{typeof(ForwardDiff.Tag(DeivVecTag(), eltype(x))),
4949
eltype(x), 1
5050
}.(x,
51-
ForwardDiff.Partials.(Tuple.(reshape(v, size(x))))))
51+
ForwardDiff.Partials.(tuple.(reshape(v, size(x))))))
5252
g = let f = f
5353
(dx, x) -> dx .= first(Zygote.gradient(f, x))
5454
end
5555
# Reset each dual number in cache1 to primal = dual = 1.
56-
cache1 .= eltype(cache1).(x, ForwardDiff.Partials.(Tuple.(reshape(v, size(x)))))
56+
cache1 .= eltype(cache1).(x, ForwardDiff.Partials.(tuple.(reshape(v, size(x)))))
5757
g(cache2, cache1)
5858
dy .= partials.(cache2, 1)
5959
end
6060

6161
function SparseDiffTools.autoback_hesvec(f, x, v)
6262
g = x -> first(Zygote.gradient(f, x))
6363
y = Dual{typeof(ForwardDiff.Tag(DeivVecTag, eltype(x))), eltype(x), 1
64-
}.(x, ForwardDiff.Partials.(Tuple.(reshape(v, size(x)))))
64+
}.(x, ForwardDiff.Partials.(tuple.(reshape(v, size(x)))))
6565
ForwardDiff.partials.(g(y), 1)
6666
end
6767

test/test_jaches_products.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function h(dy, x)
2020
end
2121

2222
cache1 = ForwardDiff.Dual{typeof(ForwardDiff.Tag(SparseDiffTools.DeivVecTag(), eltype(x))),
23-
eltype(x), 1}.(x, ForwardDiff.Partials.(Tuple.(v)))
24-
cache2 = ForwardDiff.Dual{typeof(ForwardDiff.Tag(SparseDiffTools.DeivVecTag(), eltype(x))), eltype(x), 1}.(x, ForwardDiff.Partials.(Tuple.(v)))
23+
eltype(x), 1}.(x, ForwardDiff.Partials.(tuple.(v)))
24+
cache2 = ForwardDiff.Dual{typeof(ForwardDiff.Tag(SparseDiffTools.DeivVecTag(), eltype(x))), eltype(x), 1}.(x, ForwardDiff.Partials.(tuple.(v)))
2525
@test num_jacvec!(dy, f, x, v)ForwardDiff.jacobian(f, similar(x), x) * v rtol=1e-6
2626
@test num_jacvec!(dy, f, x, v, similar(v),
2727
similar(v))ForwardDiff.jacobian(f, similar(x), x) * v rtol=1e-6
@@ -50,9 +50,9 @@ cache2 = ForwardDiff.Dual{typeof(ForwardDiff.Tag(SparseDiffTools.DeivVecTag(), e
5050
@test numback_hesvec(g, x, v)ForwardDiff.hessian(g, x) * v rtol=1e-8
5151

5252
cache3 = ForwardDiff.Dual{typeof(ForwardDiff.Tag(Nothing, eltype(x))), eltype(x), 1
53-
}.(x, ForwardDiff.Partials.(Tuple.(v)))
53+
}.(x, ForwardDiff.Partials.(tuple.(v)))
5454
cache4 = ForwardDiff.Dual{typeof(ForwardDiff.Tag(Nothing, eltype(x))), eltype(x), 1
55-
}.(x, ForwardDiff.Partials.(Tuple.(v)))
55+
}.(x, ForwardDiff.Partials.(tuple.(v)))
5656
@test autoback_hesvec!(dy, g, x, v)ForwardDiff.hessian(g, x) * v rtol=1e-8
5757
@test autoback_hesvec!(dy, g, x, v, cache3, cache4)ForwardDiff.hessian(g, x) * v rtol=1e-8
5858
@test autoback_hesvec(g, x, v)ForwardDiff.hessian(g, x) * v rtol=1e-8

0 commit comments

Comments
 (0)