Skip to content

Commit

Permalink
Bugfix: missing cholesky_lower chainrule for ReverseDiff (#285)
Browse files Browse the repository at this point in the history
* Bugfix: missing `cholesky_lower` chainrule for ReverseDiff

* Update Project.toml

* Update BijectorsReverseDiffExt.jl

* Update pd.jl

* Update BijectorsReverseDiffExt.jl

* Update pd.jl
  • Loading branch information
yebai committed Aug 16, 2023
1 parent 49c138f commit a41f840
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Bijectors"
uuid = "76274a88-744f-5084-9051-94815aaf08c4"
version = "0.13.4"
version = "0.13.5"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
8 changes: 6 additions & 2 deletions ext/BijectorsReverseDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ if isdefined(Base, :get_extension)
pd_from_lower,
lower_triangular,
upper_triangular,
transpose_eager
transpose_eager,
cholesky_lower,
cholesky_upper

using Bijectors.LinearAlgebra
using Bijectors.Compat: eachcol
Expand Down Expand Up @@ -79,7 +81,9 @@ else
pd_from_lower,
lower_triangular,
upper_triangular,
transpose_eager
transpose_eager,
cholesky_lower,
cholesky_upper

using ..Bijectors.LinearAlgebra
using ..Bijectors.Compat: eachcol
Expand Down
10 changes: 10 additions & 0 deletions test/ad/pd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@ _topd(x) = x * x' + I
test_ad(y) do y
sum(transform(binv, y))
end

if AD == "ReverseDiff" # `AD` is defined in `test/ad/utils.jl`.
test_ad(y) do y
sum(Bijectors.cholesky_lower(transform(binv, y)))
end

test_ad(y) do y
sum(Bijectors.cholesky_upper(transform(binv, y)))
end
end
end

2 comments on commit a41f840

@yebai
Copy link
Member Author

@yebai yebai commented on a41f840 Aug 16, 2023

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/89773

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.13.5 -m "<description of version>" a41f840428bca5b861ef5f6afe1c115feadfb2e9
git push origin v0.13.5

Please sign in to comment.