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

Add AbstractRNG types to fix method ambiguities in Turing #636

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

penelopeysm
Copy link
Member

Related to TuringLang/Turing.jl#2290

This PR fixes 4 of the following method ambiguities (which arise when testing Turing, but are probably better resolved here):

Ambiguity #1
dot_tilde_assume(rng, context::AbstractPPL.AbstractContext, args...) @ DynamicPPL ~/ppl/dppl/src/context_implementations.jl:294
dot_tilde_assume(context::Turing.Experimental.GibbsContext, right, left, vns, vi) @ Turing.Experimental ~/ppl/lib/src/experimental/gibbs.jl:77

Possible fix, define
  dot_tilde_assume(::Turing.Experimental.GibbsContext, ::AbstractPPL.AbstractContext, ::Any, ::Any, ::Any)

Ambiguity #2
dot_tilde_assume(rng, context::AbstractPPL.AbstractContext, args...) @ DynamicPPL ~/ppl/dppl/src/context_implementations.jl:294
dot_tilde_assume(ctx::Turing.Optimisation.OptimizationContext, right, left, vns, vi) @ Turing.Optimisation ~/ppl/lib/src/optimisation/Optimisation.jl:85

Possible fix, define
  dot_tilde_assume(::Turing.Optimisation.OptimizationContext, ::AbstractPPL.AbstractContext, ::Any, ::Any, ::Any)

Ambiguity #3
tilde_assume(rng, context::AbstractPPL.AbstractContext, args...) @ DynamicPPL ~/ppl/dppl/src/context_implementations.jl:66
tilde_assume(context::Turing.Experimental.GibbsContext, right, vn, vi) @ Turing.Experimental ~/ppl/lib/src/experimental/gibbs.jl:36

Possible fix, define
  tilde_assume(::Turing.Experimental.GibbsContext, ::AbstractPPL.AbstractContext, ::Any, ::Any)

Ambiguity #4
tilde_assume(rng, context::AbstractPPL.AbstractContext, args...) @ DynamicPPL ~/ppl/dppl/src/context_implementations.jl:66
tilde_assume(ctx::Turing.Optimisation.OptimizationContext, dist, vn, vi) @ Turing.Optimisation ~/ppl/lib/src/optimisation/Optimisation.jl:67

Possible fix, define
  tilde_assume(::Turing.Optimisation.OptimizationContext, ::AbstractPPL.AbstractContext, ::Any, ::Any)

penelopeysm and others added 2 commits August 6, 2024 12:04
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coveralls
Copy link

coveralls commented Aug 6, 2024

Pull Request Test Coverage Report for Build 10265975510

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 81.36%

Files with Coverage Reduction New Missed Lines %
src/selector.jl 1 85.71%
Totals Coverage Status
Change from base Build 10061220559: -0.03%
Covered Lines: 2811
Relevant Lines: 3455

💛 - Coveralls

@penelopeysm penelopeysm enabled auto-merge August 6, 2024 12:24
@penelopeysm penelopeysm added this pull request to the merge queue Aug 6, 2024
Merged via the queue into master with commit fe32d94 Aug 6, 2024
11 of 12 checks passed
@penelopeysm penelopeysm deleted the pysm/method-ambiguities branch August 6, 2024 14:51
@yebai
Copy link
Member

yebai commented Aug 8, 2024

@penelopeysm, feel free to modify the version and make a new release so TuringLang/Turing.jl#2290 can use the new version.

@sunxd3
Copy link
Member

sunxd3 commented Aug 8, 2024

@penelopeysm
Copy link
Member Author

Will do now, thanks for the pointers! 🙂

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.

5 participants