flowtorch
flowtorch copied to clipboard
Split Bijector
Motivation
We introduce the Split Bijector, which allows to split a tensor in half, process one half through a sequence of transformations and normalize the other.
Changes proposed
The new class first splits the tensor, then passes the outputs to the _param_fn
and then to the transform itself.
The introduction of a _forward_pre_ops
and _inverse_pre_ops
methods is necessary as, in the inverse case, we need to first pass the input through the transform inverse to then pass it through the convolutional layer that will give us the normalizing constants. This breaks the _param_fb(...)
-> _inverse(...)
logic, as we need to do something before _param_fn
. As this might be the case for the forward pass too, we introduced a similar _forward_pre_ops
method.
Types of changes
- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] The title of my pull request is a short description of the requested changes.
Codecov Report
Merging #103 (c9eee4f) into main (4992731) will increase coverage by
0.04%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 98.25% 98.29% +0.04%
==========================================
Files 6 6
Lines 229 235 +6
==========================================
+ Hits 225 231 +6
Misses 4 4
Flag | Coverage Δ | |
---|---|---|
unittests | 98.29% <100.00%> (+0.04%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
tests/test_bijectivetensor.py | 98.64% <ø> (ø) |
|
tests/test_bijector.py | 100.00% <100.00%> (ø) |
|
tests/test_distribution.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 4992731...c9eee4f. Read the comment docs.