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

Avoid unnecessary reshape for trivial expand #1776

Merged
merged 4 commits into from
Apr 12, 2024

Conversation

fehiepsi
Copy link
Member

@fehiepsi fehiepsi commented Apr 9, 2024

This PR saves unnecessary transpose, reshape operators of ExpandedDistribution's sample method. The current tests should cover the change.

This requires us to revert the order of expanded_sizes such that the dimensions are ordered from left to right (rather than the current right -> left).

Copy link
Member

@OlaRonning OlaRonning left a comment

Choose a reason for hiding this comment

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

It took a while to trigger the interstitial_sizes branch, but everything seems to work as expected.

@fehiepsi fehiepsi merged commit b2cee89 into pyro-ppl:master Apr 12, 2024
4 checks passed
@fehiepsi
Copy link
Member Author

Thanks, Ola!

OlaRonning pushed a commit to aleatory-science/numpyro that referenced this pull request May 6, 2024
* avoid unnecessary reshape for trivial expand

* do not perform unnecessary broadcasting for Delta

* fix failing tests related to Delta change

* revert change at Delta in favor of a separate PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants