TypeError: masked_select received an invalid combination of arguments - got (tor ch.ByteTensor), but expected (torch.cuda.ByteTensor mask)

I am trying to run ssd pytorch code (https://github.com/amdegroot/ssd.pytorch) its running on cpu but when I am trying to run it on gpu i got an error

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)

I am getting this error while running train_c.py , what can I do?
why i m getting this error please help

It looks like tensor is on the GPU, while mask is still on the CPU.
Could you check if MultiBoxLoss was called with use_gpu=True?
Based on the error message, it looks like pos_idx is a CPU tensor in this line of code.

yes you are right now its working thank you so much:slightly_smiling_face: