Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

indices should be either on cpu or on the same device as the indexed tensor (cpu) #40

Open
jungwonguk-up opened this issue Nov 6, 2022 · 1 comment

Comments

@jungwonguk-up
Copy link

INFO:root:GPU AVAILABLE? True
INFO:root:STARTING Dataset Creation
INFO:root:STARTING Dataloading
INFO:root:LOADING Model
INFO:root:STARTING training
INFO:root:SET model mode to train!
epoch 0 info 0 - 16: 0%| | 0/625 [00:00<?, ?it/s]C:\Dacon\Siam-NestedUNet-master\utils\metrics.py:33: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
logpt = F.log_softmax(input)
epoch 0 info 0 - 16: 0%| | 0/625 [00:02<?, ?it/s]
Traceback (most recent call last):
File "train.py", line 94, in
cd_loss = criterion(cd_preds, labels)
File "C:\Dacon\Siam-NestedUNet-master\utils\losses.py", line 17, in hybrid_loss
dice = dice_loss(prediction, target)
File "C:\Dacon\Siam-NestedUNet-master\utils\metrics.py", line 75, in dice_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)

i dont know what to do
plz help me

@bolin-sys
Copy link

I meet this question too and I pass it by using the environment of Python 3.6, Pytorch 1.4 and torchvision 0.5.0

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

No branches or pull requests

2 participants