title: Pytorch DataParallel model load with map_location
body: <ul>
  <li>Model saved with</li>
  </ul>
  <pre class="lang-py prettyprint-override"><code>net= Net()
  model= torch.nn.DataParallel(net)
  ############################
  # Training
  ############################
  
  torch.save(model,'./model_shear_pre.pkl')
  </code></pre>
  <ul>
  <li>Model loading with</li>
  </ul>
  <pre class="lang-py prettyprint-override"><code>net = Net()
  model = torch.nn.DataParallel(net, device_ids=[0,1])
  model = torch.load('./model_shear_finish.pkl',  map_location={'cuda:0':'cuda:0', 'cuda:1':'cuda:0', 'cuda:2':'cuda:1', 'cuda:3':'cuda:1'})
  </code></pre>
  <hr />
  <p>The prob is that when training I used a machine with 4 GPU, after saving the model, I would like to test it on a new  machine with only 2 GPU.</p>
  <p>After loading the saved model, I expect the model's <code>device_ids</code> would be <code>[0,1]</code>, but it still be <code>[0,1,2,3]</code> which is the old setting. <strong>Is there anything wrong when saving or loading?</strong></p>