TuringLang / DynamicPPL.jl

Implementation of domain-specific language (DSL) for dynamic probabilistic programming
https://turinglang.org/DynamicPPL.jl/
MIT License
157 stars 26 forks source link

Introduce a convenience function, `AutoType`, to hide `TypeWrap`. #610

Open yebai opened 3 months ago

yebai commented 3 months ago

We introduced the TypeWrap trick in https://github.com/TuringLang/DynamicPPL.jl/pull/597 for type stability. I find the name difficult to parse since TypeWrap does not hint at its purpose. Given that this trick is for automatically determining the suitable type during autodiff, we might want to introduce a convenience function, AutoType, so users can call models with:

demo(AutoType(Vector{Float64}))

instead of

demo(TypeWrap{Vector{Float64}}())

Related: https://github.com/TuringLang/Turing.jl/pull/2225#issue-2302319223