Roqyah_bdeen:

model = torch.nn.DataParallel(model, device_ids=self.device_ids)


I would say you have some hard-coded device inside the model.
Basically your input is in GPU 1 (this is done automatically by DataParallel
If your layer is in GPU0 it probably means you have some line with a fixed device.
Could you try your script with a simple
model = torch.nn.Linear(1,2)
and then a silly input like
model(torch.rand(4,1))