With the code cloned to local machine, removed .cuda()
and .cpu()
, this error is encountered with Python3.6 + Pytorch 0.1:
Traceback (most recent call last):
File "Neural_Style.py", line 205, in <module>
style_score += sl.backward()
File "Neural_Style.py", line 105, in backward
self.loss.backward(retain_variables=retain_variables)
File "/usr/local/lib/python3.6/site-packages/torch/autograd/variable.py", line 146, in backward
self._execution_engine.run_backward((self,), (gradient,), retain_variables)
File "/usr/local/lib/python3.6/site-packages/torch/nn/_functions/conv.py", line 48, in backward
if self.needs_input_grad[0] else None)
File "/usr/local/lib/python3.6/site-packages/torch/nn/_functions/conv.py", line 119, in _grad_input
return self._thnn('grad_input', input, weight, grad_output)
File "/usr/local/lib/python3.6/site-packages/torch/nn/_functions/conv.py", line 161, in _thnn
return impl[fn_name](self, self._bufs[0], input, weight, *args)
File "/usr/local/lib/python3.6/site-packages/torch/nn/_functions/conv.py", line 251, in call_grad_input
grad_input, weight, *args)
RuntimeError: Need gradOutput of dimension 4 and gradOutput.size[1] == 64 but got gradOutput to be of shape: [64 x 2401] at /Users/soumith/code/pytorch-builder/wheel/pytorch-src/torch/lib/THNN/generic/SpatialConvolutionMM.c:50