-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Remove p-value checks in test_transforms.py #4756
Conversation
💊 CI failures summary and remediationsAs of commit efb94f8 (more details on the Dr. CI page):
1 failure not recognized by patterns:
1 job timed out:
This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
@@ -1362,160 +1361,42 @@ def test_to_grayscale(): | |||
trans4.__repr__() | |||
|
|||
|
|||
@pytest.mark.skipif(stats is None, reason="scipy.stats not available") | |||
def test_random_grayscale(): |
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 moved this one into test_randomness
above. It will cover all the randomness-related checks in this test. For the rest (expected values), everything is already covered in test_to_grayscale()
just above.
@@ -2011,72 +1893,6 @@ def test_randomperspective_fill(mode): | |||
F.perspective(img_conv, startpoints, endpoints, fill=tuple([fill] * wrong_num_bands)) | |||
|
|||
|
|||
@pytest.mark.skipif(stats is None, reason="scipy.stats not available") | |||
def test_random_vertical_flip(): |
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.
moved this one in test_randomness
above, same for horizontal split.
assert_equal(gray_np, gray_np_3) | ||
@pytest.mark.parametrize("seed", range(10)) | ||
@pytest.mark.parametrize("p", (0, 1)) | ||
def test_random_apply(p, seed): |
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 could move this one up with test_randomness
but this would require taking care of the case where fn
is None -- this transform doesn't have a functional equivalent. Not worth it IMHO considering how simple the code is, but I don't mind
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.
Including this above will also have the negative side-effect of requiring you to modify your check condition for p=1 to out != img
which IMO is less strong to what you have above. I agree keeping this as you have it.
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, thanks for cleaning up the code.
I've only 1 remark for your consideration but it's non blocking.
assert_equal(gray_np, gray_np_3) | ||
@pytest.mark.parametrize("seed", range(10)) | ||
@pytest.mark.parametrize("p", (0, 1)) | ||
def test_random_apply(p, seed): |
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.
Including this above will also have the negative side-effect of requiring you to modify your check condition for p=1 to out != img
which IMO is less strong to what you have above. I agree keeping this as you have it.
Hey @NicolasHug! You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py |
Summary: * Change test_random_apply * Change test_random_choice * Change test_randomness * took care of RandomVert/HorizFlip * take care of RandomGrayScale * minor cleanup * avoid 0 degree rotation just in case Reviewed By: datumbox Differential Revision: D32064690 fbshipit-source-id: 8a67a56fe1e959d144b2cdf49c76610e00933508
* Change test_random_apply * Change test_random_choice * Change test_randomness * took care of RandomVert/HorizFlip * take care of RandomGrayScale * minor cleanup * avoid 0 degree rotation just in case
Towards #4506 (comment)
This PR re-works most p_value tests in
test_transforms.py
.There are still a few p_value tests in the file, but they're testing functionalities that aren't as simple as just doing
if torch.rand(1) < p: return orig_img else ...
, so we can't simplify them in the same waycc @vfdev-5 @datumbox @pmeier