Skip to content

Commit 70c2a5c

Browse files
Tangent{Tuple} and test sparsevec
Co-authored-by: Miha Zgubic <[email protected]>
1 parent d67737d commit 70c2a5c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/rulesets/SparseArrays/sparsematrix.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ end
2424
rand!(dA.nzval)
2525
I, J, V = findnz(A)
2626
= rand!(similar(V))
27-
test_rrule(findnz, A dA, output_tangent=(zeros(length(I)), zeros(length(J)), V̄))
27+
test_rrule(findnz, A dA, output_tangent=Tangent{Tuple}(zeros(length(I)), zeros(length(J)), V̄))
28+
29+
v = sparsevec([1, 2, 3], rand(3), 5)
30+
dv = sparsevec([1, 2, 3], rand(3), 5)
31+
inds, values = findnz(v)
32+
v̄alues = rand!(similar(values))
33+
test_rrule(findnz, v dv, output_tangent=Tangent{Tuple}(zeros(length(inds)), v̄alues))
2834
end
2935

3036
@testset "broadcasted cast SparseMatrixCSC" begin

0 commit comments

Comments
 (0)