PacktPublishing / Deep-Reinforcement-Learning-Hands-On

Hands-on Deep Reinforcement Learning, published by Packt
MIT License
2.8k stars 1.28k forks source link

RuntimeError in wob_click_play.py #28

Open hemanthsavasere opened 5 years ago

hemanthsavasere commented 5 years ago

Hi @Shmuma , I am getting this error,

Traceback (most recent call last): File "./wob_click_play.py", line 64, in logits_v = net(obs_v)[0] File "/home/hemanth_savasere/.conda/envs/rl_book_ch13/lib/python3.6/site-package s/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, kwargs) File "/home/hemanth_savasere/Deep-Reinforcement-Learning-Hands-On/Chapter13/lib/ model_vnc.py", line 45, in forward conv_out = self.conv(fx).view(fx.size()[0], -1) File "/home/hemanth_savasere/.conda/envs/rl_book_ch13/lib/python3.6/site-package s/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, *kwargs) File "/home/hemanth_savasere/.conda/envs/rl_book_ch13/lib/python3.6/site-package s/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/home/hemanth_savasere/.conda/envs/rl_book_ch13/lib/python3.6/site-package s/torch/nn/modules/module.py", line 491, in call result = self.forward(input, kwargs) File "/home/hemanth_savasere/.conda/envs/rl_book_ch13/lib/python3.6/site-package s/torch/nn/modules/conv.py", line 301, in forward self.padding, self.dilation, self.groups) RuntimeError: expected stride to be a single integer value or a list of 1 values t o match the convolution dimensions, but got stride=[5, 5]

vkm0cherla commented 3 years ago

this fixed it for me, in model_vnc.py#L44

    def forward(self, x):
        fx = x.unsqueeze_(0).float() / 256  # originally x.float() / 256
        conv_out = self.conv(fx).view(fx.size()[0], -1)
        return self.policy(conv_out), self.value(conv_out)