SeungyounShin / Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression

Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression
56 stars 5 forks source link

RuntimeError: Expected tensor to have cpu DeviceType, but got tensor with cuda DeviceType #2

Open Keiku opened 4 years ago

Keiku commented 4 years ago

When I placed 300W and ran train.py, I got the following error. Do you know the solution?

> python train.py                                                             11:45:54
train start!
Traceback (most recent call last):
  File "train.py", line 47, in <module>
    out = model(img)
  File "/home/anasys/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/mnt/efs/personal/kuroyanagi/work/20200528-1/Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression/models/hourglass.py", line 179, in forward
    y = self.coordconv[i](x,boundary_pred)
  File "/home/anasys/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/mnt/efs/personal/kuroyanagi/work/20200528-1/Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression/models/CoordConv.py", line 67, in forward
    ret = self.addcoords(x, boundary_map)
  File "/home/anasys/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/mnt/efs/personal/kuroyanagi/work/20200528-1/Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression/models/CoordConv.py", line 45, in forward
    xx_channel, zero_tensor)
RuntimeError: Expected tensor to have cpu DeviceType, but got tensor with cuda DeviceType (while checking arguments for CPU_tensor_apply)
>
SeungyounShin commented 4 years ago

I dont know why this error occured. It's probably different torch version creating zero_tensor in different way. I will check it as soon as possible