Kris_Kulivnyk:

targets = torch.cat((targets_dx, targets_dy, targets_dw, targets_dh), dim=1)


Hi,
Try this. Instead of device, use device=device in your code snippet. You have to change in the following line.
data, target = data.to(device), target.to(device)

It should be something as follows.
data, target = data.to(device=device), target.to(device=device)

Change other places as well if it is relevant. This may help.
Follow a similar issue here - https://github.com/pytorch/pytorch/issues/15478 7
Thanks