Facing error in pytorch v-1.1: "RuntimeError: all tensors must be on devices[0]"
I am using nn.DataParallel() for my model but facing an error.

I am doing something like

    self.model = self.model.to(device)
    self.model = nn.DataParallel(self.model)


If the device is cuda:1 then I get RuntimeError: all tensors must be on devices[0]. 
But if I change the device to cuda:0 the parallel training on multiple GPUs works with no error. I am wondering what the problem is. 

I changed this: self.model = DataParallel(self.model) to this: self.model = DataParallel(self.model, device_ids=[1,0])
Now it is working fine. But if I write: self.model = DataParallel(self.model, device_ids=[0,1]) the error pops up. If there are more GPUs, say 4, then write: self.model = DataParallel(self.model, device_ids=[1,2,3,0])
