How do I list all currently available GPUs with pytorch?
I know I can access the current GPU using torch.cuda.current_device(), but how can I get a list of all the currently available GPUs?

You can list all the available GPUs by doing:
&gt;&gt;&gt; import torch
&gt;&gt;&gt; available_gpus = [torch.cuda.device(i) for i in range(torch.cuda.device_count())]
&gt;&gt;&gt; available_gpus
[&lt;torch.cuda.device object at 0x7f2585882b50&gt;]

