I am trying to save a Dataparallel model but getting
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-17-e0020f404c69> in <module>()
     69             optimizer.zero_grad() # Zero gradients
     70             loss.backward() # Calculate gradients
---> 71             optimizer.step() # Update weights
     72             m.track_loss(loss)
     73             m.track_num_correct(preds, labels)

~/pytorch-1.0-p3/anaconda3/lib/python3.6/site-packages/torch/optim/adamw.py in step(self, closure)
     98 
     99                 # Decay the first and second moment running average coefficient
--> 100                 exp_avg.mul_(beta1).add_(1 - beta1, grad)
    101                 exp_avg_sq.mul_(beta2).addcmul_(1 - beta2, grad, grad)
    102                 if amsgrad:

RuntimeError: expected device cpu but got device cuda:0