Answers for "how to confirm if my complete code is working on gpu on pytorch"

1

pytorch check if using gpu

import torch

torch.cuda.is_available()
>>> True

torch.cuda.current_device()
>>> 0

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

torch.cuda.device_count()
>>> 1

torch.cuda.get_device_name(0)
>>> 'GeForce GTX 950M'
Posted by: Guest on May-21-2021

Code answers related to "how to confirm if my complete code is working on gpu on pytorch"

Python Answers by Framework

Browse Popular Code Answers by Language