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

invalid argument 0: Sizes of tensors must match except in dimension 1 #3

Open
artaasd95 opened this issue Sep 26, 2019 · 2 comments
Open

Comments

@artaasd95
Copy link

I am trying to train the model using a custom dataset my dataset contains BSDS500 images. when I trying to train the model this error occurs:
`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in
24 original = original.to(device)
25 original = original.unsqueeze(0)
---> 26 out = model(original)

C:\Anaconda3\envs\torchgpu\lib\site-packages\torch\nn\modules\module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)

in forward(self, inputs)
51 up3 = self.up_concat3(up4,conv3) # 64128128
52 up2 = self.up_concat2(up3,conv2) # 32256256
---> 53 up1 = self.up_concat1(up2,conv1) # 16512512
54
55 final = self.final(up1)

C:\Anaconda3\envs\torchgpu\lib\site-packages\torch\nn\modules\module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)

in forward(self, high_feature, *low_feature)
53 outputs0 = self.up(high_feature)
54 for feature in low_feature:
---> 55 outputs0 = torch.cat([outputs0, feature], 1)
56 return self.conv(outputs0)

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 321 and 320 in dimension 2 at C:/w/1/s/tmp_conda_3.6_035809/conda/conda-bld/pytorch_1556683229598/work/aten/src\THC/generic/THCTensorMath.cu:71
`

Please help what is the problem and how can I solve it?
thanks a lot

@wangxinyue11
Copy link

Have you solved it? I also encountered the same problem.

@artaasd95
Copy link
Author

@wangxinyue11 yes I resized images to 320*320 using pytorch transforms.

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