Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise istrans #655

Closed
wants to merge 1 commit into from
Closed

Optimise istrans #655

wants to merge 1 commit into from

Conversation

willtebbutt
Copy link
Member

istrans doesn't need to be differentiated through (as far as I'm aware). It's a little bit awkward in places at the minute, and adds a bit of overhead to Tapir.jl when it differentiates a Turing.jl model, so this method says "don't bother differentiating through it.

Comment on lines +14 to +15
Tapir.@is_primitive DefaultCtx Tuple{typeof(DynamicPPL.istrans), Vararg}
function Tapir.rrule!!(f::CoDual{typeof(DynamicPPL.istrans)}, x::Vararg{CoDual, N}) where {N}
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Tapir.@is_primitive DefaultCtx Tuple{typeof(DynamicPPL.istrans), Vararg}
function Tapir.rrule!!(f::CoDual{typeof(DynamicPPL.istrans)}, x::Vararg{CoDual, N}) where {N}
Tapir.@is_primitive DefaultCtx Tuple{typeof(DynamicPPL.istrans),Vararg}
function Tapir.rrule!!(f::CoDual{typeof(DynamicPPL.istrans)}, x::Vararg{CoDual,N}) where {N}

@@ -0,0 +1,9 @@
@testset "DynamicPPLTapirExt" begin
Tapir.TestUtils.test_rule(
Xoshiro(123), istrans, VarInfo();
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Xoshiro(123), istrans, VarInfo();
Xoshiro(123),
istrans,
VarInfo();

@yebai
Copy link
Member

yebai commented Sep 5, 2024

DynamicPPL master branch contains unreleased breaking changes; it’s easier to keep this extension inside Tapir for now.

@willtebbutt
Copy link
Member Author

https://github.com/compintell/Tapir.jl/

I'll move it there. Thanks for the info.

@willtebbutt willtebbutt closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants