Created
July 1, 2022 09:51
-
-
Save aliencaocao/074f7d0d6d5a833289e3972b0122ed5b to your computer and use it in GitHub Desktop.
PyTorch test if using GPU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
print(torch.cuda.is_available()) | |
print(torch.cuda.get_device_name(0)) | |
t = torch.randn(1,2).to('cuda') | |
print(t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment