Skip to content

Potentially wrong device using_cuda variable status in monai/auto3dseg/analyzer.py #8800

Closed

Description

@benediktjohannes

We set the label_tensor device to the device of the image_tensor here, but we already determined whether cuda is set or not (using_cuda) above by checking whether any of both tensors uses cuda. So in case we got label_tensor to use cuda and image_tensor not, then we would first set using_cuda to True, but then we check whether if label_tensor.device is != image_tensor.device which is True and therefore we set the device of label_tensor to non-cuda (e.g. cpu) which means that now both tensors use cpu while using_cuda is still wrongly set to True.

(see the detailed explaination in #8708, I just opened this issue here so that we don't forget about this since #8708 is already merged, but still got this potential issue open)

Activity

  1. garciadias commented on Apr 2, 2026

    @garciadias
    Collaborator

    I will create the PR now.

  2. benediktjohannes commented on Apr 2, 2026

    @benediktjohannes
    ContributorAuthor

    Thank you for doing this!

  3. added a commit that references this issue on Apr 2, 2026
    d3d0209
  4. added a commit that references this issue on May 25, 2026
    3885522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions