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

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same #1

Open
bowlderstudio opened this issue Jan 20, 2020 · 1 comment

Comments

@bowlderstudio
Copy link

Could you tell me the version of your pytorch. I got runtime error:
python main.py --algo=ppo --mode=train
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
/workdata/git/drl-experiments/ppo.py:54: UserWarning: nn.init.uniform is now deprecated in favor of nn.init.uniform_.
torch.nn.init.uniform(m.weight, -0.01, 0.01)
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
File "main.py", line 133, in
agent.train()
File "/workdata/git/drl-experiments/ppo.py", line 241, in train
values, actions, action_log_probs = self.net.act(states)
File "/workdata/git/drl-experiments/ppo.py", line 87, in act
values, action_logits = self.forward(x)
File "/workdata/git/drl-experiments/ppo.py", line 72, in forward
x = self.relu1(self.conv1(x))
File "/home/minshi/.virtualenvs/drl-experiments-0ZyJdSJ6/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/minshi/.virtualenvs/drl-experiments-0ZyJdSJ6/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 345, in forward
return self.conv2d_forward(input, self.weight)
File "/home/minshi/.virtualenvs/drl-experiments-0ZyJdSJ6/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 342, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

@bowlderstudio
Copy link
Author

I debug the problem. It seems the input of your network is a status which the dimension is only (4, 16, 8, 4) which only presents status, however the status return by the game and suppose to input into your model is (8, 4, 84, 84), which looks like image. So I guess maybe the game package I installed in different from yours.

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

1 participant