Skip to content

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