Skip to content

Commit

Permalink
Fix for default AutoForwardDiff (#581)
Browse files Browse the repository at this point in the history
* fix for default `AutoForwardDiff`

* bump patch version

* fixed bug in `dot_tilde_assume`

* fixed another `dot_tilde_assume` argument ordering
  • Loading branch information
torfjelde authored Feb 29, 2024
1 parent abcf584 commit a020171
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DynamicPPL"
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
version = "0.24.7"
version = "0.24.8"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
2 changes: 1 addition & 1 deletion ext/DynamicPPLForwardDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function LogDensityProblemsAD.ADgradient(
ForwardDiff.Tag(f, eltype(θ))
end
chunk_size = getchunksize(ad)
chunk = if chunk_size == 0
chunk = if chunk_size == 0 || chunk_size === nothing
ForwardDiff.Chunk(θ)
else
ForwardDiff.Chunk(length(θ), chunk_size)
Expand Down
4 changes: 2 additions & 2 deletions src/context_implementations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function dot_tilde_assume(context::AbstractContext, args...)
return dot_tilde_assume(NodeTrait(dot_tilde_assume, context), context, args...)
end
function dot_tilde_assume(rng, context::AbstractContext, args...)
return dot_tilde_assume(rng, NodeTrait(dot_tilde_assume, context), context, args...)
return dot_tilde_assume(NodeTrait(dot_tilde_assume, context), rng, context, args...)
end

function dot_tilde_assume(::IsLeaf, ::AbstractContext, right, left, vns, vi)
Expand All @@ -302,7 +302,7 @@ end
function dot_tilde_assume(::IsParent, context::AbstractContext, args...)
return dot_tilde_assume(childcontext(context), args...)
end
function dot_tilde_assume(rng, ::IsParent, context::AbstractContext, args...)
function dot_tilde_assume(::IsParent, rng, context::AbstractContext, args...)
return dot_tilde_assume(rng, childcontext(context), args...)
end

Expand Down
2 changes: 1 addition & 1 deletion test/ext/DynamicPPLForwardDiffExt.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testset "tag" begin
for chunksize in (0, 1, 10)
for chunksize in (nothing, 0, 1, 10)
ad = ADTypes.AutoForwardDiff(; chunksize=chunksize)
standardtag = if !isdefined(Base, :get_extension)
DynamicPPL.DynamicPPLForwardDiffExt.standardtag
Expand Down

0 comments on commit a020171

Please sign in to comment.