facebookincubator / flowtorch

This library would form a permanent home for reusable components for deep probabilistic programming. The library would form and harness a community of users and contributors by focusing initially on complete infra and documentation for how to use and create components.
https://flowtorch.ai
MIT License
300 stars 21 forks source link

Composing `Bijector`'s with different `event_dim`'s #107

Closed stefanwebb closed 2 years ago

stefanwebb commented 2 years ago

Motivation

Currently when you compose two Bijector's with different event_dims's, e.g.

bijectors = B.Compose(bijectors=[B.AffineAutoregressive(), B.Sigmoid()])

you get an error when the log_detJ term is calculated.

Changes proposed

Compose.__init__ calculates the output event_dim as the maximum over the bijectors, and the calculation of event_dim sums out extra dimensions where required.

Test Plan

See #104 for an example of code that currently fails.

codecov-commenter commented 2 years ago

Codecov Report

Merging #107 (a8ed4e3) into main (a8dbf2b) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files           6        6           
  Lines         249      249           
=======================================
  Hits          245      245           
  Misses          4        4           
Flag Coverage Δ
unittests 98.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 a8dbf2b...a8ed4e3. Read the comment docs.

facebook-github-bot commented 2 years ago

@stefanwebb has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.