Skip to content

feat: add order parameter to spline_coupling helper - #3479

Open
webzuweb wants to merge 2 commits into
pyro-ppl:devfrom
webzuweb:feat/spline-coupling-order-param
Open

webzuweb wants to merge 2 commits into
pyro-ppl:devfrom
webzuweb:feat/spline-coupling-order-param

Conversation

@webzuweb

Copy link
Copy Markdown

Description

Fixes #3417.

The spline_coupling helper lacked an order parameter, unlike the SplineCoupling class it wraps (and the sibling spline/conditional_spline helpers). This made it impossible to create a quadratic spline coupling through the helper API.

Changes

  • pyro/distributions/transforms/spline_coupling.py: add order="linear" keyword to spline_coupling, forward it to SplineCoupling, and build param_dims conditionally — quadratic splines use only widths, heights and derivatives, while linear splines additionally emit the per-bin lambda parameters.
  • tests/distributions/test_transforms.py: extend test_spline_coupling to cover both "linear" and "quadratic" orders.

Verification

  • pytest tests/distributions/test_transforms.py: 162 passed.

When a model passes an explicit subsample=idx to pyro.plate but is
composed with a guide that draws its own subsample (e.g. an AutoGuide
built without create_plates=), ReplayMessenger silently overrode the
model's index with the guide's. This decouples the model's and guide's
minibatches with no error or warning.

ReplayMessenger._pyro_sample now emits a warning when it would override a
subsample site whose explicit value differs from the guide's replayed value.
Normal subsample_size-based plates and matching subsamples are unaffected.

Fixes pyro-ppl#3468.

This branch has not been deployed

No deployments
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.

Add order parameter to spline_coupling helper function

1 participant