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

after typing model.cuda() & data.cuda() in example.py, still wrong #12

Open
tomFoxxxx opened this issue May 11, 2020 · 3 comments
Open

Comments

@tomFoxxxx
Copy link

'''
exponent = torch.exp(-.5 * torch.sum((x - mu) * (x - mu) / var, 2, keepdim=True))

RuntimeError: expected device cpu and dtype Float but got device cuda:0 and dtype Float
'''
How could this program working rightly with GPU?

@tomFoxxxx
Copy link
Author

solved!
When placing a class instance on the GPU, only properties and functions prefixed with self in init() will be placed on the GPU, and no other functions will be affected

@xiaobaoli15
Copy link

Hi,I have the same problem,can you share the detailed solution with me?thank you. @tomFoxxxx

@ldeecke
Copy link
Owner

ldeecke commented Apr 18, 2023

Hi, does this issue still appear? If so, please post a minimal example for reproduction.

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

No branches or pull requests

3 participants