In pytorch, you can set default device using the following api - https://pytorch.org/docs/stable/generated/torch.set_default_device.html But that API is missing in torchsharp