cscherrer / Soss.jl

Probabilistic programming via source rewriting
https://cscherrer.github.io/Soss.jl/stable/
MIT License
413 stars 30 forks source link

Empty transform with (new) Soss.as #342

Closed marius311 closed 2 years ago

marius311 commented 2 years ago

Looks like Soss.xform was recently replaced with Soss.as. I updated MuseInference accordingly, but now I see an error which I can track down to that the following produces an empty transform, whereas before it (correctly, I think?) contained a transform on z:

model = Soss.@model () begin
    z ~ Distributions.MvNormal(zeros(10), I)
end
Soss.as(model()) # empty transform tuple

Any help on if this is a bug or an API update appreciated!

marius311 commented 2 years ago

Any chance I could get some guidance on this one?

cscherrer commented 2 years ago

Hi @marius311 , sorry to leave you hanging. Digging into this now...

cscherrer commented 2 years ago

I fixed it up, and added this to the tests:

    @testset "https://github.com/cscherrer/Soss.jl/issues/342" begin
        m = Soss.@model () begin
            z ~ Dists.MvNormal(zeros(10), I)
        end
        t = Soss.as(m()) 
        @test TV.transform(t, zeros(10)) == (z = zeros(10), )
    end
marius311 commented 2 years ago

Awesome, thanks! Will take a look.