Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression icon indicating copy to clipboard operation
Adaptive-Wing-Loss-for-Robust-Face-Alignment-via-Heatmap-Regression copied to clipboard

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

Open Keiku opened this issue 4 years ago • 1 comments

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)
>

Keiku avatar May 30 '20 02:05 Keiku

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

SeungyounShin avatar Jun 07 '20 03:06 SeungyounShin