Skip to content

Conversation

@justincdavis
Copy link

Summary

Add the CV-CUDA for erase

Testing

python3 -m pytest test/test_transforms_v2.py::TestErase

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 5, 2025

🔗 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 SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 6 New Failures

As of commit fbd3dc1 with merge base aa35ca1 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the cla signed label Dec 5, 2025
# 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need investigation for atol = 256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants