-
Notifications
You must be signed in to change notification settings - Fork 230
Description
I think the following points regarding the current code might be problematic and changing them could improve our codebase.
-
Assume and observe dispatch on the sampler type (which is fine) but also on
Nothing. This forces us to passnothingto the functions if no sampler is defined and have aUnion{Nothing, Sampler}for the model functions. I think we can circumvent this by having different function signatures, one with and one without the sampler argument. Or do I miss something here? -
Currently assume and observe do in-place operations and not in-place operations at the same time More precisely, they change the VarInfo variable and also return values that are used later on. This is inconsistent and might lead to strange behaviour. I would prefer to make this consistent and ensure that all operations are either in-place or not. I feel the mixed behaviour is not very clean. See for example:
andTuring.jl/src/samplers/sampler.jl
Line 93 in 7cb84a5
vi.num_produce += 1 Turing.jl/src/samplers/sampler.jl
Line 42 in 7cb84a5
push!(vi, vn, r, dist, 0)
Or is there a reason why cannot do all operations in-place?
cc: @yebai