Skip to content

Commit

Permalink
LogDensityProblemsAD parent method (#198)
Browse files Browse the repository at this point in the history
* Add + test parent method

* Formatting

* Bump patch version
  • Loading branch information
willtebbutt authored Jul 23, 2024
1 parent 135bf80 commit d268fd7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Tapir"
uuid = "07d77754-e150-4737-8c94-cd238a1fb45b"
authors = ["Will Tebbutt, Hong Ge, and contributors"]
version = "0.2.24"
version = "0.2.25"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
2 changes: 2 additions & 0 deletions ext/TapirLogDensityProblemsADExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ function ADgradient(x::ADTypes.AutoTapir, ℓ)
return ADgradient(Val(:Tapir), ℓ; safety_on=x.safe_mode)
end

Base.parent(x::TapirGradientLogDensity) = Tapir.primal(x.ℓ)

end
1 change: 1 addition & 0 deletions test/integration_testing/logdensityproblemsad_interop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ test_gradient(x) = -2 .* x
end

@test ADgradient(ADTypes.AutoTapir(safe_mode=false), l) isa typeof(∇l)
@test parent(∇l) === l
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ include("front_matter.jl")
include("chain_rules_macro.jl")
elseif test_group == "integration_testing/misc"
include(joinpath("integration_testing", "logdensityproblemsad_interop.jl"))
include(joinpath("integration_testing/", "misc.jl"))
include(joinpath("integration_testing", "misc.jl"))
include(joinpath("integration_testing", "battery_tests.jl"))
elseif test_group == "integration_testing/diff_tests"
include(joinpath("integration_testing", "diff_tests.jl"))
Expand Down

2 comments on commit d268fd7

@willtebbutt
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/111592

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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

Please sign in to comment.