Skip to content

Commit b7bd291

Browse files
committed
remove duplicate _diagm_back definition
1 parent 8c3467f commit b7bd291

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/rulesets/LinearAlgebra/structured.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ end
9696

9797
function _diagm_back(p, ȳ)
9898
k, v = p
99-
d = diag(unthunk(ȳ), k)[1:length(v)] # handle if diagonal was smaller than matrix
99+
d = diag(unthunk(ȳ), k)[eachindex(v)] # handle if diagonal was smaller than matrix
100100
return Tangent{typeof(p)}(second = d)
101101
end
102102

src/rulesets/SparseArrays/sparsematrix.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,3 @@ function rrule(::typeof(spdiagm), v::AbstractVector)
160160
end
161161
return spdiagm(v), spdiagm_pullback
162162
end
163-
164-
165-
function _diagm_back(p, ȳ)
166-
k, v = p
167-
d = diag(unthunk(ȳ), k)[eachindex(v)] # handle if diagonal was smaller than matrix
168-
return Tangent{typeof(p)}(second = d)
169-
end

0 commit comments

Comments
 (0)