TuringLang / Bijectors.jl

Implementation of normalising flows and constrained random variable transformations
https://turinglang.org/Bijectors.jl/
MIT License
199 stars 32 forks source link

Add API function to retrieve size of bijector output from bijector input #265

Closed sethaxen closed 1 year ago

sethaxen commented 1 year ago

As originally noted in https://github.com/TuringLang/Bijectors.jl/pull/263#issuecomment-1577424300, the following lines assume that inputs and outputs of a bijector have the same shape, which is no longer required:

To fix this, these methods need an API function that computes the output size of a bijector from the input size, defaulting to the same size.

Alternatively, if Bijectors is meant to support non-array types, such as arbitrary Structs, then these size checks make no sense, and it is perhaps better to generalize this code.

sethaxen commented 1 year ago

Fixed by #270