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

bug: The size of tensor a (3) must match the size of tensor b (6) at non-singleton dimension 2 #6

Open
jiangjiaxi20 opened this issue Oct 26, 2020 · 12 comments

Comments

@jiangjiaxi20
Copy link

No description provided.

@jeya-maria-jose
Copy link
Owner

Can you please add more description for this error ? For which dataset and which model are you getting this bug ?

@jiangjiaxi20
Copy link
Author

i used the LIST data to train the model. got the .pth. then i run the val.py.( i did not change any parameters in parameter.py ,except those paths). Then i got the bug of models.py in line 602. "The size of tensor a (3) must match the size of tensor b (6) at non-singleton dimension 2". i tried to change the "size" of parameter.py to 8, there is no bug, but the results(pred.nii) seems bad. other size will result to similar bug. i also change the "size" of paramter.py to 24 when i run the train.py, cause i got similar bugs too.

@xuzhongyou
Copy link

yes,i have the same problem. the output size (1024) is not the same size as label(512)

@atch841
Copy link

atch841 commented Mar 2, 2021

Trying to run train.py in LiTS folder after successfully run get_training_set.py in data_prepare, but got the following error when using kiunet_org as net in model.py:
Traceback (most recent call last):
File "train.py", line 71, in
outputs = net(ct)
File "/home/viplab/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/viplab/anaconda3/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/viplab/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/viplab/nas/KiU-Net-pytorch/LiTS/net/models.py", line 591, in forward
out = torch.add(out,F.interpolate(F.relu(self.inte3_1bn(self.intere3_1(out1))),scale_factor=(0.5,0.0625,0.0625),mode ='trilinear'))
RuntimeError: The size of tensor a (3) must match the size of tensor b (6) at non-singleton dimension 2

@boneseva
Copy link

boneseva commented Mar 10, 2021

I have the same problem with running (almost) any of the models on my own data:
out1 = torch.add(out1,F.interpolate(F.relu(self.inte1_2bn(self.intere1_2(tmp))),scale_factor=(4,4),mode ='bilinear')) RuntimeError: The size of tensor a (386) must match the size of tensor b (384) at non-singleton dimension 3

@zx-123456
Copy link

I have the same problem,So how to solve it?

@momo1986
Copy link

Have same problem kiunet_org.

@AasiaRehman
Copy link

I have the same issue has anybody solved it

@SorryMaker511
Copy link

The same problem arose when I use kiunet_org for training

@zhouyizhuo
Copy link

Did you guys solve the problem?

@zhouyizhuo
Copy link

Trying to run train.py in LiTS folder after successfully run get_training_set.py in data_prepare, but got the following error when using kiunet_org as net in model.py: Traceback (most recent call last): File "train.py", line 71, in outputs = net(ct) File "/home/viplab/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/viplab/anaconda3/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward return self.module(*inputs[0], **kwargs[0]) File "/home/viplab/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/viplab/nas/KiU-Net-pytorch/LiTS/net/models.py", line 591, in forward out = torch.add(out,F.interpolate(F.relu(self.inte3_1bn(self.intere3_1(out1))),scale_factor=(0.5,0.0625,0.0625),mode ='trilinear')) RuntimeError: The size of tensor a (3) must match the size of tensor b (6) at non-singleton dimension 2

@atch841 @momo1986
Did you solve the problem?

@zhouyizhuo
Copy link

@SorryMaker511

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

10 participants