Skip to content

Instantly share code, notes, and snippets.

@aliencaocao
Created July 1, 2022 09:51
Show Gist options
  • Save aliencaocao/074f7d0d6d5a833289e3972b0122ed5b to your computer and use it in GitHub Desktop.
Save aliencaocao/074f7d0d6d5a833289e3972b0122ed5b to your computer and use it in GitHub Desktop.
PyTorch test if using GPU
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