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

What to write in place of the "device" in this code? #2952

Closed
jaskiratsingh2000 opened this issue Apr 27, 2021 · 1 comment
Closed

What to write in place of the "device" in this code? #2952

jaskiratsingh2000 opened this issue Apr 27, 2021 · 1 comment
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@jaskiratsingh2000
Copy link

❔Question

What to write in place of the device in this code?

Additional context

Hey, I am trying to run the profiling and unable to understand that what I need to write in place of "device" in the following code.

img = torch.rand(8 if torch.cuda.is_available() else 1, 3, 320, 320).to(device) 
y = model(img, profile=True)

If in case I remove the "device" from here then it throws me the following error:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-7-f21874f58c27> in <module>()
----> 1 img = torch.rand(8 if torch.cuda.is_available() else 1, 3, 320, 320).to(device)
      2 y = model(img, profile=True)

NameError: name 'device' is not defined
@jaskiratsingh2000 jaskiratsingh2000 added the question Further information is requested label Apr 27, 2021
@glenn-jocher
Copy link
Member

@jaskiratsingh2000 do not raise duplicate issues. This is already explained in #2898 (comment)

@glenn-jocher glenn-jocher added the duplicate This issue or pull request already exists label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants