pytorch Obtenha o número da GPU
torch.cuda.device_count()
Smoggy Squirrel
torch.cuda.device_count()
import torch
available_gpus = [torch.cuda.device(i) for i in range(torch.cuda.device_count())]
available_gpus
#[<torch.cuda.device object at 0x7f2585882b50>]