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

UserWarning: using a target size (torch.Size([1])) that is different to input size (torch.Size([])) #1

Closed
br-salima opened this issue Jul 17, 2020 · 4 comments

Comments

@br-salima
Copy link

Hello good author,
First Thank you so much for your amazing code, can I get some help please
i tried to test your code but i get this warning {UserWarning: using a target size (torch.Size([1])) that is different to input size (torch.Size([])) } and i cant figure out where is the problem exactly .
Thank you.

@lllllllllllll-llll
Copy link
Owner

Hello, do you mean this error occurred where you were running the training code? Could you tell me where the error occurred?

@br-salima
Copy link
Author

Hello sir,
Yes , I got this warning when I started the traning

< ./lib/python3.6/site-packages/torch/nn/modules/loss.py:88: UserWarning: Using a target size (torch.Size([1])) that is different to the input size (torch.Size([])). 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) >
and it affects the results a lot < Epoch 0 Valid Results: loss=26.629 SROCC=0.177 PLCC=0.356 KROCC=0.131 RMSE=31.221
Epoch 0 Test Results: loss=26.473 SROCC=0.222 PLCC=0.340 KROCC=0.165 RMSE=30.960 >
Thanks for your reply .

@lllllllllllll-llll
Copy link
Owner

Hello, I ran the code but found no errors during the training progress.
During the training progress, the size of each output and label:
outputs_NSS.size()=[128, 36]
features.size()=[128, 36]
outputs_q.size()=[128, 1]
label.size()=[128, 1]
you can print the size of the output and label to check out that.
And I'm using PyTorch 0.4.1, or maybe the version causes the error? Can you tell me your PyTorch version and the size of outputs to check out why this error happens?

@br-salima
Copy link
Author

hello sir,
I changed my Pytorch version to your version and it works very well thank you soo much .

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