Skip to content

Dimension Error in train.py #23

@shiva811

Description

@shiva811

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions