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

Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! error #56

Open
seigot opened this issue Aug 10, 2022 · 1 comment · May be fixed by #169
Labels

Comments

@seigot
Copy link
Owner

seigot commented Aug 10, 2022

torch.cuda.is_available()はTrueであるものの、to be on the same device ということでおそらく計算時にcpu/cudaどちらかで計算するように寄せる必要がありそうなメッセージにみえました。
https://discuss.pytorch.org/t/expected-all-tensors-to-be-on-the-same-device-but-found-at-least-two-devices-cuda-0-and-cpu-error/151314/7
Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! error

Move alpha to the same device.

理想的にはどちらもcudaにするのが良さそうではあるのですが、回避策としてcpuに寄せるのも一つの手ではと思いました。(とても重いconvolution等でなければ、、)
具体的には以下のような感じでcudaを使わないようにコメントアウトしたらcpuで動いてくれたりしないでしょうかね。。
https://raw.githubusercontent.com/seigot/tools/master/tetris/20220315_disable_cuda.patch

  •        if torch.cuda.is_available():
    
  •            next_states = next_states.cuda()
    

+# if torch.cuda.is_available():
+# next_states = next_states.cuda()

@gitauto-ai gitauto-ai bot added the gitauto label Nov 15, 2024
Copy link
Contributor

gitauto-ai bot commented Nov 15, 2024

Hey, I'm a bit lost here! Not sure which file I should be fixing. Could you give me a bit more to go on? Maybe add some details to the issue or drop a comment with some extra hints? Thanks!

Have feedback or need help?
Feel free to email [email protected].

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