TypeError:masked_select接收到无效的参数组合-得到了(tor ch.ByteTensor),但是是预期的(torch.cuda.ByteTensor mask)

时间:2018-11-14 09:11:53

标签: python pytorch torch

我正在尝试运行ssd pytorch代码(https://github.com/amdegroot/ssd.pytorch) 它在cpu上运行,但是当我尝试在gpu上运行时出现错误

Traceback (most recent call last):

    File "train_c.py", line 267, in 
        train()

    File "train_c.py", line 190, in train
        loss_l, loss_c = criterion(out, targets)

    File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/torch/nn/modules/modu le.py", line 325, in call
        result = self.forward(*input, **kwargs)
    File "/home/ubuntu/ssd.pytorch/layers/modules/multibox_loss.py", line 88, in f orward
        loc_p = loc_data[pos_idx].view(-1, 4)
    File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/torch/autograd/variab le.py", line 74, in getitem
        return MaskedSelect.apply(self, key)
    File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/torch/autograd/_funct ions/tensor.py", line 465, in forward
        return tensor.masked_select(mask)
TypeError: masked_select received an invalid combination of arguments - got (tor ch.ByteTensor), but expected (torch.cuda.ByteTensor mask)

运行train.py时出现此错误,该怎么办?

0 个答案:

没有答案