Skip to content

Commit

Permalink
Merge pull request #111 from invenia/mz/densification
Browse files Browse the repository at this point in the history
Fix _densification_pullback bug
  • Loading branch information
mzgubic authored Jul 25, 2022
2 parents 7bac0da + e7f8c20 commit 6223d3f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BlockDiagonals"
uuid = "0a1fb500-61f7-11e9-3c65-f5ef3456f9f0"
authors = ["Invenia Technical Computing Corporation"]
version = "0.1.34"
version = "0.1.35"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
2 changes: 1 addition & 1 deletion src/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ChainRulesCore.rrule(::Type{<:BlockDiagonal}, blocks::Vector{V}) where
end

# densification
function _densification_pullback(Ȳ::Matrix, T, nrows, ncols)
function _densification_pullback(Ȳ::AbstractMatrix, T, nrows, ncols)
row_idxs = cumsum(nrows) .- nrows .+ 1
col_idxs = cumsum(ncols) .- ncols .+ 1

Expand Down
3 changes: 2 additions & 1 deletion test/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
end

@testset "Matrix" begin
D = BlockDiagonal([randn(1, 2), randn(2, 2)])
D = BlockDiagonal([randn(2, 2), randn(2, 2)])
test_rrule(Matrix, D)
test_rrule(Matrix, D, output_tangent=UpperTriangular(rand(4, 4)))
end

@testset "BlockDiagonal * Vector" begin
Expand Down

2 comments on commit 6223d3f

@mzgubic
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/64928

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.35 -m "<description of version>" 6223d3f28c0db66b2ab42ca23176c87fb384d59b
git push origin v0.1.35

Please sign in to comment.