Skip to content

Commit 5370e55

Browse files
committed
formatting
1 parent d1a5bab commit 5370e55

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

ext/DynamicPPLJETExt.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ function DynamicPPL.is_suitable_varinfo(
4949
end
5050

5151
function DynamicPPL._determine_varinfo_jet(
52-
model::DynamicPPL.Model,
53-
context::DynamicPPL.AbstractContext;
54-
only_tilde::Bool=true,
52+
model::DynamicPPL.Model, context::DynamicPPL.AbstractContext; only_tilde::Bool=true
5553
)
5654
# First we try with the typed varinfo.
5755
varinfo = if DynamicPPL.hassampler(context)
@@ -64,9 +62,7 @@ function DynamicPPL._determine_varinfo_jet(
6462
issuccess = true
6563

6664
# Let's make sure that both evaluation and sampling doesn't result in type errors.
67-
issuccess, reports = DynamicPPL.is_suitable_varinfo(
68-
model, context, varinfo; only_tilde
69-
)
65+
issuccess, reports = DynamicPPL.is_suitable_varinfo(model, context, varinfo; only_tilde)
7066

7167
if !issuccess
7268
# Useful information for debugging.

src/model_utils.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ See also: [`DynamicPPL.is_suitable_varinfo`](@ref).
252252
- `only_tilde`: If `true`, only consider error reports occuring in the tilde pipeline. Default: `true`.
253253
"""
254254
function determine_suitable_varinfo(
255-
model::Model,
256-
context::AbstractContext=SamplingContext();
257-
only_tilde::Bool=true,
255+
model::Model, context::AbstractContext=SamplingContext(); only_tilde::Bool=true
258256
)
259257
# If JET.jl has been loaded, and thus `determine_varinfo` has been defined, we use that.
260258
if Base.get_extension(DynamicPPL, :DynamicPPLJETExt) !== nothing

test/ext/DynamicPPLJETExt.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
end
1010
end
1111
model = demo1()
12-
@test DynamicPPL.determine_suitable_varinfo(model; verbose=true) isa
13-
DynamicPPL.UntypedVarInfo
12+
@test DynamicPPL.determine_suitable_varinfo(model) isa DynamicPPL.UntypedVarInfo
1413

1514
@model demo2() = x ~ Normal()
1615
@test DynamicPPL.determine_suitable_varinfo(demo2()) isa DynamicPPL.TypedVarInfo
@@ -25,8 +24,7 @@
2524
z ~ Normal()
2625
end
2726
end
28-
@test DynamicPPL.determine_suitable_varinfo(demo3(); verbose=true) isa
29-
DynamicPPL.UntypedVarInfo
27+
@test DynamicPPL.determine_suitable_varinfo(demo3()) isa DynamicPPL.UntypedVarInfo
3028

3129
# Evaluation works (and it would even do so in practice), but sampling
3230
# fill fail due to storing `Cauchy{Float64}` in `Vector{Normal{Float64}}`.
@@ -38,8 +36,7 @@
3836
y ~ Cauchy() # different distibution, but same transformation
3937
end
4038
end
41-
@test DynamicPPL.determine_suitable_varinfo(demo4(); verbose=true) isa
42-
DynamicPPL.UntypedVarInfo
39+
@test DynamicPPL.determine_suitable_varinfo(demo4()) isa DynamicPPL.UntypedVarInfo
4340

4441
# In this model, the type error occurs in the user code rather than in DynamicPPL.
4542
@model function demo5()
@@ -51,12 +48,10 @@
5148
return sum(xs)
5249
end
5350
# Should pass if we're only checking the tilde statements.
54-
@test DynamicPPL.determine_suitable_varinfo(demo5(); verbose=true) isa
55-
DynamicPPL.TypedVarInfo
51+
@test DynamicPPL.determine_suitable_varinfo(demo5()) isa DynamicPPL.TypedVarInfo
5652
# Should fail if we're including errors in the model body.
57-
@test DynamicPPL.determine_suitable_varinfo(
58-
demo5(); verbose=true, only_tilde=false
59-
) isa DynamicPPL.UntypedVarInfo
53+
@test DynamicPPL.determine_suitable_varinfo(demo5(); only_tilde=false) isa
54+
DynamicPPL.UntypedVarInfo
6055
end
6156

6257
@testset "demo models" begin

0 commit comments

Comments
 (0)