Skip to content
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

Vector-version for PDBijector #271

Merged
merged 27 commits into from
Jun 20, 2023
Merged

Vector-version for PDBijector #271

merged 27 commits into from
Jun 20, 2023

Conversation

torfjelde
Copy link
Member

@torfjelde torfjelde commented Jun 18, 2023

Similar vein to #246 and #263.

NOTE: This is based on #270 .

src/bijectors/pd.jl Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ext/BijectorsTrackerExt.jl Outdated Show resolved Hide resolved
ext/BijectorsTrackerExt.jl Outdated Show resolved Hide resolved
torfjelde and others added 3 commits June 18, 2023 12:19
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@torfjelde torfjelde assigned devmotion and yebai and unassigned devmotion and yebai Jun 19, 2023
torfjelde referenced this pull request Jun 19, 2023
* added output_length and output_size to compute output, well, leengths
and sizes for transformations

* added tests for size of transformed dist using VcCorrBijector

* use already constructed transfrormation

* TransformedDistribution should now also have correct variate form

* added proper variateform handling for VecCholeskyBijector too

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* added output_size impl for Reshape too

* bump minor version

* Apply suggestions from code review

Co-authored-by: David Widmann <[email protected]>

* Update src/interface.jl

* Update src/bijectors/corr.jl

* reverted removal of length as we'll need it now

* updated Stacked to be compat with changing sizes

* forgot to commit deetion

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* add testing of sizes to `test_bijector`

* some more tests for stacked

* Update test/bijectors/stacked.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* added awful generated function to determine output ranges for Stacked
with tuple because recursive implementation fail

* added slightly more informative comment

* format

* more fixes to that damned Stacked

* Update test/interface.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* specialized constructors for Stacked further

* fixed bug in output_size for CorrVecBijector

* Apply suggestions from code review

Co-authored-by: David Widmann <[email protected]>

* Apply suggestions from code review

Co-authored-by: David Widmann <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Widmann <[email protected]>
@torfjelde
Copy link
Member Author

I made an issue to remind us that we should improve this implementation in the future. But for now I think we should just make it work, and then we can make it fast later.

@yebai yebai requested a review from harisorgn June 19, 2023 16:16
torfjelde referenced this pull request Jun 19, 2023
* Remove unused proj field

* Update simplex bijector calls

* Update simplex jacobian calls

* Remove proj type entry

* Compute logdetjac from square part of jacobian

* Increment minor version number

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: David Widmann <[email protected]>

* Update test/interface.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fixed link and invlink for SimplexBijector

* Update src/Bijectors.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* super-hacky fix to size issue of TransformedDistribution

* added fixme comment

* removed redundant constructor for Stacked

* added implementation of output_size for SimplexBijector

* Update src/bijectors/simplex.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fixed tests

* removed more references to old SimplexBijector code

* fixed more dirichlet tests

* formatting

* possilby fixed weird formatting complaints

* Apply suggestions from code review

Co-authored-by: David Widmann <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: Hong Ge <[email protected]>
Co-authored-by: Tor Erlend Fjelde <[email protected]>
@torfjelde
Copy link
Member Author

Just pushing this once more: the release of 0.13 is just waiting for this PR. We should really get this in the same batch because it will technically be breaking. Otherwise we'll have to release 0.14 immediately after 0.13 😕

Could someone maybe just give it a quick look-over and hit approve? 😬 There really isn't anything controversial in here + it just reuses existing implementation.

@torfjelde
Copy link
Member Author

Well shit. I messed up. My previous comment no longer holds true 😬

Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by your last comment, what exactly does not hold anymore?

src/utils.jl Outdated Show resolved Hide resolved
src/utils.jl Outdated Show resolved Hide resolved
@@ -529,7 +529,27 @@ end

# NOTE: Probably doesn't work in complete generality.
wrap_chainrules_output(x) = x
function wrap_chainrules_output(x::ChainRulesCore.Thunk)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this covered by the tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it isn't! But do we want to? 😕
I just started writing a test, and the realized it means I have to move wrap_chainrules__output to Bijectors.jl itself rather than as an extension. But it's only really used for Tracker (it is also used for one part in ReverseDiffjl, but this can be dropped in favor of the macro that has been added to ReverseDiff.jl).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it isn't!

But does that mean it's not needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, well, yes 🙃

Also, just realized, the reason why it's probably not there is because this will only be called from Tracker.@grad function which of course should never use @thunk 😬 I'll remove it 👍

src/bijectors/pd.jl Outdated Show resolved Hide resolved
test/bijectors/pd.jl Outdated Show resolved Hide resolved
@torfjelde
Copy link
Member Author

Well shit. I messed up. My previous comment no longer holds true grimacing

Haha, I wanted to defer the release of Bijectors 0.13 until this had been merged, but in my excitement I forgot and made a release. Hence my comments regarding this above ain't no truth anymore 😬

But I think just releasing this as 0.13.1 is fine so np 👍

@torfjelde
Copy link
Member Author

I believe comments have been addressed:)

@torfjelde torfjelde merged commit 8a4790a into master Jun 20, 2023
@delete-merged-branch delete-merged-branch bot deleted the torfjelde/pd-vec branch June 20, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants