Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "RuntimeError: Expected object of type torch.FloatTensor but foun… #333

Merged
merged 1 commit into from
Jul 23, 2018

Conversation

shuieryin
Copy link
Contributor

Fix following runtime error when continued training using gpu, the model has to be cuda before optimizer load state dict, the tensor inside will still be cpu float type otherwise.

Traceback (most recent call last):
  File "train.py", line 270, in <module>
    optimizer.step()
  File "/usr/local/lib/python3.6/dist-packages/torch/optim/sgd.py", line 101, in step
    buf.mul_(momentum).add_(1 - dampening, d_p)
RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 'other'

…d type torch.cuda.FloatTensor for argument SeanNaren#4 'other'" for File "train.py", line 270, in <module> optimizer.step()
@shuieryin
Copy link
Contributor Author

reference #195 #210

@SeanNaren SeanNaren merged commit 94d6ad2 into SeanNaren:master Jul 23, 2018
@SeanNaren
Copy link
Owner

tyvm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants