abhiskk/fast-neural-style

Runtime error while trying out the toy example

whiletruelearn opened this issue · 2 comments

I am getting a runtime error w.r.t tensor size while trying out the toy example.

RuntimeError: The expanded size of the tensor (1080) must match the existing size (32) at non-singleton dimension 2. at /opt/conda/conda-bld/pytorch_1502001039157/work/torch/lib/TH/generic/THTensor.c:308

I am using Python 2.7 and used conda install pytorch torchvision -c soumith to install pytorch

Stack trace

File "~/envs/py27/lib/python2.7/site-packages/torch/nn/modules/module.py", line 224, in __call__ result = self.forward(*input, **kwargs) File "~/fast-neural-style/neural_style/transformer_net.py", line 131, in forward mean = torch.mean(t, 2).unsqueeze(2).expand_as(x) File "~/envs/py27/lib/python2.7/site-packages/torch/autograd/variable.py", line 725, in expand_as return Expand.apply(self, (tensor.size(),)) File "~/envs/py27/lib/python2.7/site-packages/torch/autograd/_functions/tensor.py", line 111, in forward result = i.expand(*new_size)

I added a fix for this 34edece, this was because of the changes in 0.2 version of pytorch. Thanks @whiletruelearn for reporting this.

Closing the issue, please comment if similar problems occur.