Skip to content
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

Fixes device mismatch issue while building docs #5428

Merged

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Feb 16, 2022

Description:

  • Issue:

While trying to build docs on a machine with GPU and optical flow gallery example is failing with device mismatch:

/vision/gallery/plot_optical_flow.py failed to execute correctly: Traceback (most recent call last):
  File "/vision/gallery/plot_optical_flow.py", line 164, in <module>
    flow_imgs = flow_to_image(predicted_flows)
  File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/vision/torchvision/utils.py", line 432, in flow_to_image
    img = _normalized_flow_to_image(normalized_flow)
  File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/vision/torchvision/utils.py", line 467, in _normalized_flow_to_image
    col = (1 - f) * col0 + f * col1
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

Here is minimal fix

@facebook-github-bot
Copy link

facebook-github-bot commented Feb 16, 2022

💊 CI failures summary and remediations

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


💚 💚 Looks good so far! There are no failures yet. 💚 💚


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

@jdsgomes jdsgomes left a comment

Choose a reason for hiding this comment

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

thank you for the fix. LGTM!

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 @vfdev-5 !

@NicolasHug NicolasHug merged commit 144f098 into pytorch:main Feb 16, 2022
@vfdev-5 vfdev-5 deleted the fix-docs-gallery-build-device-mismatch branch February 16, 2022 11:34
NicolasHug pushed a commit to NicolasHug/vision that referenced this pull request Feb 16, 2022
NicolasHug pushed a commit to NicolasHug/vision that referenced this pull request Feb 16, 2022
NicolasHug pushed a commit to NicolasHug/vision that referenced this pull request Feb 16, 2022
jdsgomes pushed a commit that referenced this pull request Feb 16, 2022
facebook-github-bot pushed a commit that referenced this pull request Feb 25, 2022
Reviewed By: jdsgomes

Differential Revision: D34475315

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

None yet

4 participants