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

Error in running the cyclegan code #2

Open
soumyadeepg opened this issue Dec 19, 2017 · 1 comment
Open

Error in running the cyclegan code #2

soumyadeepg opened this issue Dec 19, 2017 · 1 comment

Comments

@soumyadeepg
Copy link

soumyadeepg commented Dec 19, 2017

In the cycle gan code i am getting the following error while training the model

File "CycleGAN.py", line 211, in
outA = D_A(real_A)
File "/home/iab/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/media/iab/New Volume/soumyadeep/Paper-Implementations-master/cycleGAN/model/Discriminator.py", line 57, in forward
out = self.layer2(out)
File "/home/iab/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/home/iab/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/container.py", line 67, in forward
input = module(input)
File "/home/iab/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/media/iab/New Volume/soumyadeep/Paper-Implementations-master/cycleGAN/model/Discriminator.py", line 25, in forward
mean = torch.mean(t, 2).unsqueeze(2).expand_as(x)
File "/home/iab/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/autograd/variable.py", line 725, in expand_as
return Expand.apply(self, (tensor.size(),))
File "/home/iab/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/autograd/_functions/tensor.py", line 111, in forward
result = i.expand(*new_size)
RuntimeError: The expanded size of the tensor (32) must match the existing size (128) at non-singleton dimension 2. at /opt/conda/conda-bld/pytorch_1503966894950/work/torch/lib/THC/generic/THCTensor.c:323

PLEASE HELP !!

@MapleSpirit
Copy link

MapleSpirit commented Jun 20, 2018

Because the mean function has decrease the dimension of the tensor and the default setting for the parameter 'keepdim ' in pytorch 0.4 is False. The code should be re-written as torch.mean(input, dim, keepdim=True)

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

2 participants