Erase CV-CUDA Backend#9304
Open
justincdavis wants to merge 20 commits intopytorch:mainfrom
Open
Conversation
…memcpy hack, need to figure out
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9304
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: ❌ 6 New FailuresAs of commit fbd3dc1 with merge base aa35ca1 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
zy1git
reviewed
Jan 15, 2026
| # packed types (_2S32, _3S32) need to be copied into pre-allocated tensors | ||
| # torch does not support these packed types directly, so we create a helper function | ||
| # which will enable torch copy into the data directly (by overriding type/strides info) | ||
| def _to_torch(cv_tensor: cvcuda.Tensor, shape: tuple[int, ...], typestr: str) -> torch.Tensor: |
Contributor
There was a problem hiding this comment.
Consider moving _to_torch to module level — currently it's recreated on every function call.
Not a performance concern for typical usage, but cleaner for readability.
| return erase_image(video, i=i, j=j, h=h, w=w, v=v, inplace=inplace) | ||
|
|
||
|
|
||
| def _erase_image_cvcuda( |
Contributor
There was a problem hiding this comment.
Need to take a closer look at the implementation @NicolasHug
| # CV-CUDA doesnt have same random distribution as torchvision | ||
| # it uses its own seeding, but we have determinism | ||
| # set seed with torch.randint in the kernel | ||
| assert_close(actual, expected, rtol=0, atol=256) |
Contributor
There was a problem hiding this comment.
need investigation for atol = 256
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the CV-CUDA for
eraseTesting
python3 -m pytest test/test_transforms_v2.py::TestErase