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

Address user warnings in tests #54

Merged
merged 17 commits into from
Oct 25, 2021

Conversation

FernandoDavis
Copy link
Contributor

@FernandoDavis FernandoDavis commented Oct 21, 2021

Resolves #32 and #36.

@bwohlberg bwohlberg added the tests Pertaining to SCICO tests label Oct 21, 2021
B = Convolve(np.ones((2, 2)), (9, 15))
a = jax.device_put(np.ones((3, 3)))
A = Convolve(a, (9, 15))
b = jax.device_put(np.ones((2, 2)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't just do A = Convolve(jax.device_put(np.ones((3, 3))), (9, 15))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, just thought it would be more readable to separate it, but I can def fix that and make it more compact.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is more readable, but the more compact form is already used in so many other places my leaning would be to just accept that as the standard way of doing this.

@bwohlberg
Copy link
Collaborator

Test failures need to be resolved. I assume they're related to the changes in scico/solver.py?

@FernandoDavis
Copy link
Contributor Author

Yeah, the failing tests are due to the merge if im not mistaken so until that is fixed the PR has to remain on hold.

@bwohlberg
Copy link
Collaborator

Yeah, the failing tests are due to the merge if im not mistaken so until that is fixed the PR has to remain on hold.

In which file? Were there merge conflicts in scico/solver.py?

@bwohlberg bwohlberg changed the title Fernando davis/address user warnings in tests Address user warnings in tests Oct 21, 2021
@bwohlberg bwohlberg linked an issue Oct 21, 2021 that may be closed by this pull request
# Ignores warning raised by ensure_on_device
warnings.filterwarnings(action="ignore", category=UserWarning)

# Verifies that there is a warning on f.grad and fg.grad
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This addresses the TODO: should tweak test to verify that there is a warning on f.grad and fg.grad

# Used to restore the warnings after the context is used
with warnings.catch_warnings():
# Ignores warning raised by ensure_on_device
warnings.filterwarnings(action="ignore", category=UserWarning)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lukepfister Hey Luke, whenever you have some time, is it necessary to make sure that the functionals are smooth for this test case? Or is it okay to suppress those user warnings and test that the warnings are properly being raised?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that ideally the functionals would be smooth, but it's fine to just suppress-- it's not the point of this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright then I'll have a chat with Brendt and the group about making any new functionals smooth, and if possible override this code snippet in the future to account for that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose that ideally the functionals would be smooth, but it's fine to just suppress-- it's not the point of this test.

Do you mean that a better approach would be to modify the test so that it's only applied to functionals that are marked as smooth?

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be reasonable. If I remember correctly we don’t have very many smooth functional though.

@bwohlberg bwohlberg merged commit 416a2d3 into main Oct 25, 2021
@bwohlberg bwohlberg deleted the FernandoDavis/address_user_warnings_in_tests branch October 25, 2021 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Pertaining to SCICO tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Nelder-Mead / gradient warning during pytest UserWarning in tests
4 participants