iArunava/ENet-Real-Time-Semantic-Segmentation

getting Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

Closed this issue · 4 comments

I am using google colab with GPU support (tesla K80).
I used this command

!python3 init.py --mode train -iptr /content/ENet-Real-Time-Semantic-Segmentation/datasets/dataset_enet/train/ -lptr /content/ENet-Real-Time-Semantic-Segmentation/datasets/dataset_enet/trainannot/ --cuda False

Here is my log:
Traceback (most recent call last):
File "init.py", line 119, in
train(FLAGS)
File "/content/ENet-Real-Time-Semantic-Segmentation/train.py", line 75, in train
out = enet(X_batch.float())
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/content/ENet-Real-Time-Semantic-Segmentation/models/ENet.py", line 191, in forward
x = self.init(x)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/content/ENet-Real-Time-Semantic-Segmentation/models/InitialBlock.py", line 37, in forward
main = self.conv(x)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 320, in forward
self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

@iArunava
we need to pass the weight through CUDA.
weights.cuda()

Since you have gpu, please change --cuda True
So,
!python3 init.py --mode train -iptr /content/ENet-Real-Time-Semantic-Segmentation/datasets/dataset_enet/train/ -lptr /content/ENet-Real-Time-Semantic-Segmentation/datasets/dataset_enet/trainannot/

Sorry, but the default value is False for cuda. Just say --cuda True instead of --cuda False
Don't leave the --cuda argument blank
Let me know.

Since you have gpu, please change --cuda True
So,
!python3 init.py --mode train -iptr /content/ENet-Real-Time-Semantic-Segmentation/datasets/dataset_enet/train/ -lptr /content/ENet-Real-Time-Semantic-Segmentation/datasets/dataset_enet/trainannot/

No response from the Author for more than two weeks.