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(wzl): change [] to nn.ModuleList in MDDPG_Critic to avoid differe… #12

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

zerlinwang
Copy link

command

sh ./train_mpe_maddpg.sh

error

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

reason

self.q_outs = [init_(nn.Linear(self.hidden_size, 1)) for _ in range(num_q_outs)]
self.to(device)
In this way, the to(device) won’t transfer these parameters to the desired device.

ref

https://discuss.pytorch.org/t/is-it-mandatory-to-add-modules-to-modulelist-to-access-its-parameters/81622/7

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.

1 participant