-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Elastic CV-CUDA Backend #9293
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
base: main
Are you sure you want to change the base?
Elastic CV-CUDA Backend #9293
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9293
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 5 New FailuresAs of commit 95cbb8b with merge base aa35ca1 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
29df2ef to
be9183a
Compare
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 left some comments for the first round review. Feel free to let me know your thoughts.
| @pytest.mark.needs_cvcuda | ||
| @needs_cuda |
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.
We can just use @needs_cvcuda, check:
https://github.com/pytorch/vision/pull/9305/changes#diff-9c2dde92db86c123fee225e39b7c1ef96e08a3e79a9dcc9a2d68b21ed51a81d0R6849-R6850
|
|
||
| # checking properties that are not the pixel values | ||
| # see note below on pixel-value differences | ||
| assert_close(result, expected, atol=get_max_value(torch.uint8), rtol=0) |
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.
get_max_value(torch.uint8) is 255. This assertion will pass for any pixel values (since uint8 range is 0-255). The comment says "checking properties that are not the pixel values" - does this mean it's checking shape/dtype? If so, consider making that explicit:
assert result.shape == expected.shape
assert result.dtype == expected.dtype| # visually, the results are identical, however the underlying computations are different | ||
| # we can define an mae_threshold based on the interpolation mode | ||
| # the primary difference is along the borders where pixels appear to be shifted in location | ||
| # by up to 1, causing potentially up to a diff of 255 on a single pixel | ||
| # this could be because one has fill of 0 and CV-CUDA is shifted and has value with some color | ||
| # thresholds decrease as image size gets larger since shifted pixels are fewer in comparision |
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.
Need some more investigation about this. @NicolasHug
| # this could be because one has fill of 0 and CV-CUDA is shifted and has value with some color | ||
| # thresholds decrease as image size gets larger since shifted pixels are fewer in comparision | ||
| mae = (expected.float() - result.float()).abs().mean() | ||
| mae_threshold = 30.0 if interpolation is transforms.InterpolationMode.NEAREST else 20.0 |
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.
Enum comparison is preferred to use "==".
| """ | ||
| Get the CV-CUDA interpolation mode for a given interpolation mode. | ||
| CV-CUDA has the two following differences (evaluated in tests) comapred to TorchVision/PIL: |
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.
typo for "comapred"
Summary
Implements Elastic using CV-CUDA backend kernel with
cvcuda.remapTesting
python3 -m pytest test/test_transforms_v2.py::TestElastic