-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Refactored and modified private api for resize functional op #6191
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
Conversation
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 for the PR @vfdev-5. I have a few questions for you below. Let me know what you think.
@@ -412,19 +410,15 @@ def test_resize_scripted(self, dt, size, max_size, interpolation, device): | |||
# This is a trivial cast to float of uint8 data to test all cases | |||
tensor = tensor.to(dt) | |||
if max_size is not None and len(size) != 1: | |||
pytest.xfail("with max_size, size must be a sequence with 2 elements") | |||
pytest.skip("Size should be an int or a sequence of length 1 if max_size is specified") |
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.
Question: Why skip instead of xfail?
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.
That's a good question :)
According to https://docs.pytest.org/en/stable/how-to/skipping.html
We skip in case windows tests on non-windows platform and xfail if we expect a test to fail for some reason.
In our case, the configuration "max_size is not None and len(size) != 1" can not be tested as we explicitly raise and error. Proper solution to that is to catch the error and check the message text with pytest.raises
.
I felt like skipping is more appropriate than xfail. But it is a matter of taste if you think it is better to revert to xfail I can do that and will only fix the message which is incorrect
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.
I was expecting a pytest.raises where if I'm honest but no strong opinions.
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.
LGTM, our offline discussion covers all my points. I'll let @vfdev-5 summarize what we discussed.
…#6191) Summary: * Refactored and modified private api for resize functional op * Fixed failures * More updates * Fixed flake8 Reviewed By: NicolasHug Differential Revision: D37450358 fbshipit-source-id: 173d75ecb293eb418e9e7df9ff9eb152dd17f4ac
@vfdev-5 pointed me to this PR from our discussions in #6209 (comment) As discussed over there, |
It's possible if we introduce additional |
I guess we could just define it in |
@NicolasHug as far as I know those APIs are private and this change has been done many versions ago. I don't think we should worry about BC here. |
I'm not sure I understand. Wasn't this PR merged 5 days ago?
Unfortunately there is absolutely nothing that indicates that they are private. |
Sorry I was referring to when the API became private not to this PR. Let's continue our discussion at #6209 (comment) to avoid further confusion |
Description:
_compute_output_size
and removedmax_size
arg fromF_t.resize
andF_pil.resize
._compute_output_size
in proto for bboxes (right nowmax_size
is not taken into account)resize_image_*
. This will be fixed in [proto] Improvements for functional API and tests #6187