-
Notifications
You must be signed in to change notification settings - Fork 7.2k
CVCUDA backend design #9259
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?
CVCUDA backend design #9259
Conversation
Summary:
Users have to explicitly opt-in for those transforms. Here we provide the first building block for this interface. We add the functionals `to_nvcv_image` and `nvcv_to_tensor` to transform `torch.Tensor` to `nvcv.Tensor`. We also implement the corresponding class transforms `ToNVCVImage` and `NVCVToTensor`.
## How to use
```python
from PIL import Image
import torchvision.transforms.v2.functional as F
orig_img = Image.open("leaning_tower.jpg")
img_tensor = F.pil_to_tensor(orig_img)
nvcv_tensor = F.to_nvcv_tensor(img_tensor.cuda())
img_tensor = F.nvcv_to_tensor(nvcv_tensor)
```
NOTE: NVCV tensors are automatically converted to NHWC format. Contrary to torchvision convention, which relies on NCHW format.
Differential Revision: D85862362
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9259
Note: Links to docs will display an error until the docs builds have been completed. ❌ 9 New FailuresAs of commit e96659c with merge base 2fee489 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@AntoineSimoulin has exported this pull request. If you are a Meta employee, you can view the originating Diff in D85862362. |
|
NOTES:
|
|
@AntoineSimoulin has imported this pull request. If you are a Meta employee, you can view this in D85862362. |
Summary
Users have to explicitly opt-in for those transforms. Here we provide the first building block for this interface. We add the functionals
to_nvcv_imageandnvcv_to_tensorto transformtorch.Tensortonvcv.Tensor. We also implement the corresponding class transformsToNVCVImageandNVCVToTensor.How to use
Note
NVCV tensors are automatically converted to NHWC format. Contrary to torchvision convention, which relies on NCHW format.
Run unit tests
pytest test/test_cvcuda.py ... 37 passed in 0.15sDifferential Revision: D85862362