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.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same #52

Open
forhonourlx opened this issue Feb 12, 2019 · 2 comments · May be fixed by #114

Comments

@forhonourlx
Copy link

Traceback (most recent call last):
File "examples.py", line 566, in
ppo_pixel_atari(game)
File "examples.py", line 391, in ppo_pixel_atari
run_steps(PPOAgent(config))
File "/home/simon/Desktop/DeepRL.old/deep_rl/agent/PPO_agent.py", line 25, in init
torchsummary.summary(self.network,(4, 84, 84))
File "/home/simon/anaconda3/lib/python3.6/site-packages/torchsummary/torchsummary.py", line 72, in summary
model(*x)
File "/home/simon/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/simon/Desktop/DeepRL.old/deep_rl/network/network_heads.py", line 173, in forward
phi = self.network.phi_body(obs)
File "/home/simon/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/simon/Desktop/DeepRL.old/deep_rl/network/network_bodies.py", line 19, in forward
y = F.relu(self.conv1(x))
File "/home/simon/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/simon/anaconda3/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 320, in forward
self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

@dc3ea9f
Copy link

dc3ea9f commented Feb 18, 2019

There are two ways to fix it:

  1. convert your network to cuda
  2. call torchsummary.summary with device='cpu'

@ghost
Copy link

ghost commented Mar 11, 2019

#36

@Gokkulnath Gokkulnath linked a pull request Feb 26, 2020 that will close this issue
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 a pull request may close this issue.

2 participants