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

Fix the same device issue #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Anshita1Saxena
Copy link

Hi Authors,

I fixed this issue RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) in file utils/losses.py.
Please review it and merge it.

Stacktrace:

Epoch 1:
^M  0%|          | 0/396 [00:00<?, ?it/s]^M  0%|          | 0/396 [00:29<?, ?it/s]
Traceback (most recent call last):
  File "/project/60025/anshita/ClimateNet/example.py", line 20, in <module>
    cgnet.train(train)
  File "/project/60025/anshita/ClimateNet/climatenet/models.py", line 90, in train
    loss = jaccard_loss(outputs, labels)
  File "/project/60025/anshita/ClimateNet/climatenet/utils/losses.py", line 21, in jaccard_loss
    true_1_hot = torch.eye(num_classes)[true.squeeze(1)]
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

Thank You.

Best regards,
Anshita Saxena

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant