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

[WIP] Conv1x1 #105

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft

[WIP] Conv1x1 #105

wants to merge 23 commits into from

Conversation

vmoens
Copy link
Contributor

@vmoens vmoens commented Apr 26, 2022

Motivation

Proposes a 1x1 convolution bijector.

Test Plan

from flowtorch.bijectors import Conv1x1Bijector
import torch


def test(LU_decompose, zero_init):
    c = Conv1x1Bijector(LU_decompose=LU_decompose, zero_init=zero_init)
    c = c(shape=torch.Size([10, 20, 20]))
    for p in c.parameters():
        p.data += torch.randn_like(p)/5

    x = torch.randn(1, 10, 20, 20)
    y = c.forward(x)
    yp = y.detach_from_flow()
    xp = c.inverse(yp)
    assert (xp/x-1).norm() < 1e-2

    assert (xp-x).norm()
    
for LU_decompose in (True, False):
    for zero_init in (True, False):
        test(True, True)

Important

This PR is branched out from the coupling layer. I'll update the branch once the review of the coupling layer is completed.

@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 26, 2022
@vmoens vmoens changed the title Convx11 [WIP] Convx11 Apr 26, 2022
@vmoens vmoens changed the title [WIP] Convx11 [WIP] Conv1x1 Apr 26, 2022
@vmoens vmoens marked this pull request as draft April 26, 2022 15:08
# Conflicts:
#	flowtorch/bijectors/__init__.py
#	flowtorch/bijectors/base.py
#	flowtorch/bijectors/compose.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.

2 participants