Support different transformed and untransformed variable lengths
It would be nice to relax the assumption that transformed and untransformed variables must have the same linearized lengths. We can introduce a new function variable_length which takes a distribution argument and a transformed kwarg. This function can then be defined for common distributions.
I thought there was an issue about this in Bijectors, for inputs and outputs of different size but also more generally for inputs and outputs of different types, but I can't find it. So maybe it was only discussed in some PR.
That's true but there is also a DPPL issue mostly in the VarInfo where linearized values in the transformed and untransformed domains are assumed to have the same length.
A temporary solution is to resize when calling link! or invlink! and re-calculate the indices.
Or to not transform in-place (this was also discussed at some point) and/or to use a different non-linearized structure (IIRC there are some discussions that were moved to AbstractPPL).
As a temporary workaround you can just fill the transformed values with 0s (or some other value) but I guess that's maybe what you want to avoid here.
Closed in favour of https://github.com/TuringLang/DynamicPPL.jl/issues/461