title: Invalid device id when using pytorch dataparallel！
body: <h1>Environment：</h1>
  
  <ul>
  <li>Win10  </li>
  <li>Pytorch 1.3.0  </li>
  <li>python3.7</li>
  </ul>
  
  <h1>Problem：</h1>
  
  <p>I am using <code>dataparallel</code> in Pytorch to use the two 2080Ti GPUs. Code are like below:</p>
  
  <pre class="lang-py prettyprint-override"><code>device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
  
  model = Darknet(opt.model_def)  
  model.apply(weights_init_normal) 
  
  model = nn.DataParallel(model, device_ids=[0, 1]).to(device)
  </code></pre>
  
  <p>But when run this code, I encounter errors below:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/Administrator/Desktop/PyTorch-YOLOv3-master/train.py", line 74, in &lt;module&gt;
      model = nn.DataParallel(model, device_ids=[0, 1]).to(device)
    File "C:\Users\Administrator\Anaconda3\envs\py37_torch1.3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 133, in __init__
      _check_balance(self.device_ids)
    File "C:\Users\Administrator\Anaconda3\envs\py37_torch1.3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 19, in _check_balance
      dev_props = [torch.cuda.get_device_properties(i) for i in device_ids]
    File "C:\Users\Administrator\Anaconda3\envs\py37_torch1.3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 19, in &lt;listcomp&gt;
      dev_props = [torch.cuda.get_device_properties(i) for i in device_ids]
    File "C:\Users\Administrator\Anaconda3\envs\py37_torch1.3\lib\site-packages\torch\cuda\__init__.py", line 337, in get_device_properties
      raise AssertionError("Invalid device id")
  AssertionError: Invalid device id
  </code></pre>
  
  <p>When I debug into it, I find the function <code>device_count()</code> in <code>get_device_properties()</code> returns 1 while I have 2 GPU on my machine. And <code>torch._C._cuda_getDeviceCount()</code> returns 2 in Anaconda Prompt. What is wrong?</p>
  
  <h1>Qustion:</h1>
  
  <p>How to solve this problem?
  How can I manage to use the two GPUs using dataparallel?
  Thank you guys!</p>