Skip to content

Conversation

sumanthratna
Copy link
Contributor

@sumanthratna sumanthratna commented Dec 15, 2021

Background

without this PR, this happens when image is on a CUDA device:

  File ".../my_code.py", line 186, in build_graph
    wsi_with_patches = draw_bounding_boxes(wsi, boxes)  # `wsi` is on CUDA device 0
  File ".../venv/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File ".../venv/lib/python3.8/site-packages/torchvision/utils.py", line 188, in draw_bounding_boxes
    ndarr = image.permute(1, 2, 0).numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

Notes

  • not detaching the tensor because the function is decorated with torch.no_grad

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Dec 15, 2021

💊 CI failures summary and remediations

As of commit 858d63a (more details on the Dr. CI page):


  • 1/1 failures introduced in this PR

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build unittest_prototype (1/1)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

�[31m============================== �[31m�[1m6 ...0.31s�[0m�[31m ===============================�[0m
E   ImportError: cannot import name 'ShardingFilter' from 'torch.utils.data.datapipes.iter' (/home/circleci/.local/lib/python3.7/site-packages/torch/utils/data/datapipes/iter/__init__.py)�[0m
------ generated xml file: /home/circleci/project/test-results/junit.xml -------
=========================== short test summary info ============================
ERROR test/test_prototype_builtin_datasets.py
ERROR test/test_prototype_datasets_api.py
ERROR test/test_prototype_datasets_utils.py
ERROR test/test_prototype_features.py
ERROR test/test_prototype_models.py
ERROR test/test_prototype_transforms.py
!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!
�[31m============================== �[31m�[1m6 errors�[0m�[31m in 0.31s�[0m�[31m ===============================�[0m


Exited with code exit status 2


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Copy link
Contributor

@prabhat00155 prabhat00155 left a comment

Choose a reason for hiding this comment

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

Thanks @sumanthratna for the fix. I guess this may have only been tested for CPU tensors only. I see a potential for a similar issue in draw_keypoints(). Do you want to fix that as well?

@sumanthratna
Copy link
Contributor Author

Thanks @sumanthratna for the fix. I guess this may have only been tested for CPU tensors only. I see a potential for a similar issue in draw_keypoints(). Do you want to fix that as well?

sure, I can fix that issue—should I do it in a separate PR or add it to this one?

@prabhat00155
Copy link
Contributor

sure, I can fix that issue—should I do it in a separate PR or add it to this one?

Feel free to create a separate PR, thanks!

@prabhat00155 prabhat00155 merged commit 582d12a into pytorch:main Dec 15, 2021
@github-actions
Copy link

Hey @prabhat00155!

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

@sumanthratna sumanthratna deleted the patch-1 branch December 15, 2021 23:59
@prabhat00155 prabhat00155 added other if you have no clue or if you will manually handle the PR in the release notes and removed bug labels Dec 19, 2021
facebook-github-bot pushed a commit that referenced this pull request Dec 21, 2021
Reviewed By: prabhat00155

Differential Revision: D33253480

fbshipit-source-id: 298255437e7faa1f86db16ad246c8e536980cd92
@oke-aditya
Copy link
Contributor

Sorry, but I guess the label for this should be bug fix and not other.

@prabhat00155 prabhat00155 added bug and removed other if you have no clue or if you will manually handle the PR in the release notes labels Dec 31, 2021
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.

4 participants