Skip to content

Commit

Permalink
remove duplicate _diagm_back definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ElOceanografo committed Oct 12, 2023
1 parent 8c3467f commit b7bd291
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion src/rulesets/LinearAlgebra/structured.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ end

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

Expand Down
7 changes: 0 additions & 7 deletions src/rulesets/SparseArrays/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,3 @@ function rrule(::typeof(spdiagm), v::AbstractVector)
end
return spdiagm(v), spdiagm_pullback
end


function _diagm_back(p, ȳ)
k, v = p
d = diag(unthunk(ȳ), k)[eachindex(v)] # handle if diagonal was smaller than matrix
return Tangent{typeof(p)}(second = d)
end

0 comments on commit b7bd291

Please sign in to comment.