import torch is_gpu = torch.cuda.is_available() print(str(is_gpu))