is that equivalent to:
use_cuda = torch.cuda.is_available() device = torch.device("cuda" if use_cuda else "cpu") model = MyModel() model.to(device)
?