What’s torch.cuda.device_count() return value?
Have you tried:
dev_count = torch.cuda.device_count()
if  dev_count > 1:
    net = nn.DataParallel(net, device_ids=list(range(dev_count)))

Also looks like 4 8+ GPUs is not handled very well. So it might from torch.cuda.device_count(). If that works for you (you know the number of GPUs) :
dev_count = 10
net = nn.DataParallel(net, device_ids=list(range(dev_count)))