To use a different gpu in the system, isn’t when you declare the device
mydevice=torch.device(“cuda:2”)
or
mydevice=torch.device(“cuda”, 2)
the point is you have to pass the ordinal for the gpu you want to use.
See torch.device at Tensor Attributes — PyTorch 1.8.1 documentation 69