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

Add ComplexTransform and update biject_to registry. #1964

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

tillahoffmann
Copy link
Contributor

I added a complex constraint in #1762 with biject_to using the identity function as shown below. This makes inference challenging in practice because we end up with a mix of real and complex parameters.

@biject_to.register(constraints.complex)
def _transform_to_complex(constraint):
return IdentityTransform()

This PR adds a ComplexTransform which turns a real tensor of shape (..., 2) into a complex tensor of shape (...). It also updates the biject_to registry such that complex variables can be integrated into models (e.g., for FFTs) while ensuring that the unconstrained space is real.

Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@fehiepsi fehiepsi merged commit a9c9fc6 into pyro-ppl:master Jan 30, 2025
10 checks passed
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.

2 participants