-
Notifications
You must be signed in to change notification settings - Fork 164
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
refactor: remove deprecated x_shape where not needed. #1271
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1271 +/- ##
==========================================
- Coverage 86.05% 78.27% -7.79%
==========================================
Files 118 119 +1
Lines 8672 8695 +23
==========================================
- Hits 7463 6806 -657
- Misses 1209 1889 +680
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @janfb! I think it's a good idea, but was hoping you could clarify why we remove the x_shape
argument from, e.g. NRE
or ensemble_posterior
, which are not new?
I agree, we should not remove it from the ensemble posterior init. I think it's fine to remove from NRE because it is used there only internally, i.e., it is set but then not used. |
@@ -96,7 +96,6 @@ def __init__( | |||
potential_fn=potential_fn, | |||
theta_transform=theta_transform, | |||
device=device, | |||
x_shape=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is passed as None
explicitly here, i.e., the x_shape
argument was not added to the user-facing constructor in the first place.
Thus I think it's fine to remove it here.
@@ -203,7 +202,6 @@ def train( | |||
theta[self.train_indices].to("cpu"), | |||
x[self.train_indices].to("cpu"), | |||
) | |||
self._x_shape = x_shape_from_simulation(x.to("cpu")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._x_shape
is not used internally anymore, so it's safe to remove it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmoss13 I added explanations in comments. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for clarifying! I agree with your comments
x_shape
as argument to posteriors is deprecated. We still have for backwards compatibility in some posteriors.However, we don't need it in the new posteriors. We can also remove it in some internal uses - which is done in this PR.