Skip to content

Conversation

@malfet
Copy link
Contributor

@malfet malfet commented Mar 9, 2023

It only works for CPU tensors, so raise an error if called with non-CPU tensor

Add unit test to validate for that

Followups: one also needs to check that tensors passed to this function is contiguous

Fixes #7391

It only works for CPU tensors, so raise an error if called with non-CPU
tensor
@malfet malfet requested a review from NicolasHug March 9, 2023 16:46
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 9, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/7406

Note: Links to docs will display an error until the docs builds have been completed.

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

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks @malfet , some suggestion below but I'll approve to unblock the cherry-picking

@needs_cuda
def test_decode_image_cuda_raises():
data = torch.randint(0, 127, size=(255,), device="cuda", dtype=torch.uint8)
exception_raised = True
Copy link
Member

Choose a reason for hiding this comment

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

Nit: this can be removed now

Suggested change
exception_raised = True

Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be a nit, since (amongst other things) it breaks the lint workflow: https://app.circleci.com/jobs/github/pytorch/vision/1851401

Copy link
Member

Choose a reason for hiding this comment

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

@malfet malfet merged commit a73285a into main Mar 10, 2023
@malfet malfet deleted the malfet/decode-image-device-check branch March 10, 2023 06:44
@github-actions
Copy link

Hey @malfet!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

facebook-github-bot pushed a commit that referenced this pull request Mar 30, 2023
Summary: Co-authored-by: Nicolas Hug <[email protected]>

Reviewed By: vmoens

Differential Revision: D44416571

fbshipit-source-id: 9009b4353c3b5a18df8fb7688a92614e49f7a661
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.

torchvision.io.decode_image: segmentation fault on cuda

5 participants