-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to Composed
and TruncatedBijector
fixing #40
#52
Improvements to Composed
and TruncatedBijector
fixing #40
#52
Conversation
Looks good to me overall! |
@torfjelde Can I merge this now? |
Yup! Though maybe I should bump the version number? I guess this would technically be a breaking change since the circ-operation now has different behavior. Should I bump the minor- or patch-version? EDIT: Actually, let me do a "review" myself tomorrow and make sure everything is good. Shouldn't be any bugs, just filling in some simply additions e.g. just realized I had forgotten to implement the transform and |
Should be good now @kai!:) |
Thanks for the great work! |
Overview
This PR introduces most of the performance improvements to
Composed
discussed in #46 and theTruncatedBijector
discussed in #40 makingbijector(d::Distribution)
type-stable and providing a good "default" bijector.In addition to the above,
Test.@inferred
is now used extensively intest/interface.jl
to try and catch instability for the<:Tuple
versions ofComposed
andStacked
.Finally the project structure has been changed a bit (for the better). Implementations of
Bijector
are now found in thesrc/bijectors
directory, e.g.src/bijectors/scale.jl
. This makes it much easier for people unfamiliar with the code to contribute, plus easier to reason about in general.Changes
Composed
From a user-perspective, the major change is that
∘
will now "flatten" the composition structure in the sense thatwhile in master it looks like
Note that this is only the case for
∘
. In some cases it might be desirable to keep certain operations together, e.g.Composed{Tuple{Scale, Shift}}}
represents an affine transformation. Thereforecomposel
andcomposer
will not do this "flattening", but instead preserve the structure of the compositions.The above is also described in the docstring of
Composed
.