Snippets Collections
import torch

print('cuda available: ', torch.cuda.is_available())
print('device count: ', torch.cuda.device_count())
print('cuda current device: ', torch.cuda.current_device())
print('cude device name: ', torch.cuda.get_device_name(0))
print('allocated memory: ', torch.cuda.memory_allocated())
print('allocated memory: ', torch.cuda.memory_cached())

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

Mon Apr 25 2022 07:51:01 GMT+0000 (Coordinated Universal Time)

#colab #torch #cuda #gpu

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension