-
Notifications
You must be signed in to change notification settings - Fork 7.2k
[pytest port] color_jitter, pad, crop, center_crop in test_transforms_tensor #4008
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
[pytest port] color_jitter, pad, crop, center_crop in test_transforms_tensor #4008
Conversation
|
||
|
||
@pytest.mark.parametrize('device', cpu_and_gpu()) | ||
class TestColorJitter: |
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.
Thought it would be better to have a separate class for all these tests. Also, avoids extra lines of code repetition of @pytest.mark.parametrize('device', cpu_and_gpu())
for each test.
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 a lot @AnirudhDagar ! I'll sync with master and merge
@pytest.mark.parametrize('padding_config', [ | ||
{"padding_mode": "constant", "fill": 0}, | ||
{"padding_mode": "constant", "fill": 10}, | ||
{"padding_mode": "constant", "fill": 20}, | ||
{"padding_mode": "edge"}, | ||
{"padding_mode": "reflect"} | ||
]) | ||
@pytest.mark.parametrize('size', [5, [5, ], [6, 6]]) |
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 parametrization and the config["size"] = size
below is a bit unnatural. I think it mostly comes from the fact that we want to avoid passing a default for fill
but its default is 0 and we already hardcode it here. Maybe parametrizing over 'padding_mode, fill' and 'size' would make more sense, instead of parametrizing over 'padding_config'.
But it's not super important, so let's leave it as is!
…ransforms_tensor (#4008) Reviewed By: fmassa Differential Revision: D29097726 fbshipit-source-id: 4fe118454563828f6413804f9bcee7c5b2fa74f8
This PR ports group B from #3987. All the tests below run on
cpu_and_gpu
and have been parametrized accordingly.test_color_jitter
: split into five new test functions as belowtest_pad
test_crop
: split into two test functions.test_crop
test_crop_pad
test_center_crop
: There was no need to split or parameterize this.