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

Dimension Error in train.py #23

Open
shiva811 opened this issue May 24, 2021 · 0 comments
Open

Dimension Error in train.py #23

shiva811 opened this issue May 24, 2021 · 0 comments

Comments

@shiva811
Copy link

I am running train.py with the correct options and it is givinig me this error
21-05-24 21:22:32.620 - INFO: Loading model for G [/data2/superresolution/real-world-sr/esrgan-fs/experiments/Multiview_SR/models/55000_G.pth] ... 21-05-24 21:22:32.946 - INFO: Model [SRGANModel] is created. 21-05-24 21:22:32.946 - INFO: Start training from epoch: 0, iter: 0 /data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/modules/loss.py:94: UserWarning: Using a target size (torch.Size([16, 3, 128, 128])) that is different to the input size (torch.Size([16, 3, 256, 256])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.l1_loss(input, target, reduction=self.reduction) Traceback (most recent call last): File "train.py", line 244, in <module> main() File "train.py", line 163, in main model.optimize_parameters(current_step) File "/data3/shivam/lsdr/Real-SR/codes/models/SRGAN_model.py", line 147, in optimize_parameters l_g_pix = self.l_pix_w * self.cri_pix(self.fake_H, self.var_H) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 94, in forward return F.l1_loss(input, target, reduction=self.reduction) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/functional.py", line 2633, in l1_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/functional.py", line 71, in broadcast_tensors return _VF.broadcast_tensors(tensors) # type: ignore RuntimeError: The size of tensor a (256) must match the size of tensor b (128) at non-singleton dimension 3

Please can somebody help me resolve this error? I am looking at all the possible cases which could have caused this but couldn't find one yet.

I would be very thankful if you could offer some suggestions or advice.

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

1 participant