DynamicPPL.jl icon indicating copy to clipboard operation
DynamicPPL.jl copied to clipboard

Support different transformed and untransformed variable lengths

Open mohdibntarek opened this issue 4 years ago • 5 comments

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.

mohdibntarek avatar May 08 '21 06:05 mohdibntarek

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.

devmotion avatar May 08 '21 07:05 devmotion

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.

mohdibntarek avatar May 08 '21 07:05 mohdibntarek

A temporary solution is to resize when calling link! or invlink! and re-calculate the indices.

mohdibntarek avatar May 08 '21 07:05 mohdibntarek

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).

devmotion avatar May 08 '21 08:05 devmotion

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.

devmotion avatar May 08 '21 08:05 devmotion

Closed in favour of https://github.com/TuringLang/DynamicPPL.jl/issues/461

yebai avatar Aug 02 '23 22:08 yebai