Hello (sorry for the late reply)
Regarding your first question, self.res[i].to(x.device).
I do this because I need to reduce the size (c*2) of the concatenated features in the previous step.
Here, self.res() = nn.Conv2d(c*2, c, stride=1, 0) where c is the size of x1 and x2
As for the full error messages:
Epoch: 1
train:   0%|                                                                       | 0/146 [00:12<?, ?it/s]
Traceback (most recent call last):
  File "train_network.py", line 112, in <module>
    train_logs, *_ = train_epoch.run(train_dataloader)
  File "/uge_mnt/home/bruno/parallel/codes/tools.py", line 125, in run
    loss, y_pred = self.batch_update(x, y)
  File "/uge_mnt/home/bruno/parallel/codes/tools.py", line 180, in batch_update
    loss.backward()
  File "/home/xxx/apps/intelpython3/lib/python3.6/site-packages/torch/tensor.py", line 118, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/home/xxx/apps/intelpython3/lib/python3.6/site-packages/torch/autograd/__init__.py", line 93, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: expected device cuda:3 and dtype Float but got device cuda:2 and dtype Float

many thanks in advance for your help