Skip to content

Commit 9d1a707

Browse files
authored
Try #454:
2 parents a2bdc16 + 8d77d78 commit 9d1a707

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.21.6"
3+
version = "0.22.0"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
@@ -24,7 +24,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
2424
AbstractMCMC = "2, 3.0, 4"
2525
AbstractPPL = "0.5.3"
2626
BangBang = "0.3"
27-
Bijectors = "0.5.2, 0.6, 0.7, 0.8, 0.9, 0.10"
27+
Bijectors = "0.11"
2828
ChainRulesCore = "0.9.7, 0.10, 1"
2929
ConstructionBase = "1"
3030
Distributions = "0.23.8, 0.24, 0.25"

src/abstract_varinfo.jl

+4-5
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ end
405405

406406
# Vector-based ones.
407407
function link!!(
408-
t::StaticTransformation{<:Bijectors.Bijector{1}},
408+
t::StaticTransformation{<:Bijectors.Transform},
409409
vi::AbstractVarInfo,
410410
spl::AbstractSampler,
411411
model::Model,
@@ -420,7 +420,7 @@ function link!!(
420420
end
421421

422422
function invlink!!(
423-
t::StaticTransformation{<:Bijectors.Bijector{1}},
423+
t::StaticTransformation{<:Bijectors.Transform},
424424
vi::AbstractVarInfo,
425425
spl::AbstractSampler,
426426
model::Model,
@@ -452,9 +452,8 @@ julia> using DynamicPPL, Distributions, Bijectors
452452
julia> @model demo() = x ~ Normal()
453453
demo (generic function with 2 methods)
454454
455-
julia> # By subtyping `Bijector{1}`, we inherit the `(inv)link!!` defined for
456-
# bijectors which acts on 1-dimensional arrays, i.e. vectors.
457-
struct MyBijector <: Bijectors.Bijector{1} end
455+
julia> # By subtyping `Transform`, we inherit the `(inv)link!!`.
456+
struct MyBijector <: Bijectors.Transform end
458457
459458
julia> # Define some dummy `inverse` which will be used in the `link!!` call.
460459
Bijectors.inverse(f::MyBijector) = identity

src/simple_varinfo.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ Distributions.loglikelihood(model::Model, θ) = loglikelihood(model, SimpleVarIn
648648

649649
# Allow usage of `NamedBijector` too.
650650
function link!!(
651-
t::StaticTransformation{<:Bijectors.NamedBijector},
651+
t::StaticTransformation{<:Bijectors.NamedTransform},
652652
vi::SimpleVarInfo{<:NamedTuple},
653653
spl::AbstractSampler,
654654
model::Model,
@@ -663,7 +663,7 @@ function link!!(
663663
end
664664

665665
function invlink!!(
666-
t::StaticTransformation{<:Bijectors.NamedBijector},
666+
t::StaticTransformation{<:Bijectors.NamedTransform},
667667
vi::SimpleVarInfo{<:NamedTuple},
668668
spl::AbstractSampler,
669669
model::Model,

src/test_utils.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ Simple model for which [`default_transformation`](@ref) returns a [`StaticTransf
686686
end
687687

688688
function DynamicPPL.default_transformation(::Model{typeof(demo_static_transformation)})
689-
b = Bijectors.stack(Bijectors.Exp{0}(), Bijectors.Identity{0}())
689+
b = Bijectors.stack(Bijectors.elementwise(exp), identity)
690690
return DynamicPPL.StaticTransformation(b)
691691
end
692692

test/Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2323
[compat]
2424
AbstractMCMC = "2.1, 3.0, 4"
2525
AbstractPPL = "0.5.1, 0.6"
26-
Bijectors = "0.9.5, 0.10"
26+
Bijectors = "0.11"
2727
Distributions = "0.25"
2828
DistributionsAD = "0.6.3"
2929
Documenter = "0.26.1, 0.27"

test/simple_varinfo.jl

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
@testset "$(typeof(vi))" for vi in (
6565
SimpleVarInfo(Dict()), SimpleVarInfo(values_constrained), VarInfo(model)
6666
)
67+
vi = SimpleVarInfo(values_constrained)
6768
for vn in DynamicPPL.TestUtils.varnames(model)
6869
vi = DynamicPPL.setindex!!(vi, get(values_constrained, vn), vn)
6970
end
@@ -108,6 +109,8 @@
108109

109110
@testset "SimpleVarInfo on $(nameof(model))" for model in
110111
DynamicPPL.TestUtils.DEMO_MODELS
112+
model = DynamicPPL.TestUtils.demo_dot_assume_matrix_dot_observe_matrix()
113+
111114
# We might need to pre-allocate for the variable `m`, so we need
112115
# to see whether this is the case.
113116
svi_nt = SimpleVarInfo(rand(NamedTuple, model))

0 commit comments

Comments
 (0)