Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How do I check if PyTorch is using the GPU?

>>> import torch

>>> torch.cuda.is_available()
True

>>> torch.cuda.device_count()
1

>>> torch.cuda.current_device()
0

>>> torch.cuda.device(0)
<torch.cuda.device at 0x7efce0b03be0>

>>> torch.cuda.get_device_name(0)
'GeForce GTX 950M'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #I #check #PyTorch
ADD COMMENT
Topic
Name
3+2 =