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

Split Bijector #103

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

Split Bijector #103

wants to merge 31 commits into from

Conversation

vmoens
Copy link
Contributor

@vmoens vmoens commented Apr 21, 2022

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)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • 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.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 21, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #103 (c9eee4f) into main (4992731) will increase coverage by 0.04%.
The diff coverage is 100.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%) ⬆️

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.

@vmoens vmoens linked an issue Apr 22, 2022 that may be closed by this pull request
# Conflicts:
#	flowtorch/bijectors/base.py
#	flowtorch/bijectors/compose.py
#	flowtorch/bijectors/ops/spline.py
#	tests/test_bijector.py
# Conflicts:
#	flowtorch/bijectors/coupling.py
#	flowtorch/bijectors/ops/affine.py
#	flowtorch/parameters/__init__.py
#	flowtorch/parameters/base.py
#	tests/test_bijector.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split bijector
3 participants