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

ValueError: Target and input must have the same number of elements. target nelement (128) != input nelement (98) #3

Open
DanhNamHoang opened this issue Jan 9, 2020 · 0 comments

Comments

@DanhNamHoang
Copy link

DanhNamHoang commented Jan 9, 2020

Hi Ralmohsen,
When i run train_AAE.py, without change original source code, there have a isse like this:

Running on GeForce RTX 2080 Ti Train set size: 33800 /home/jason/.local/lib/python3.6/site-packages/torch/nn/functional.py:1386: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.") /home/jason/.local/lib/python3.6/site-packages/torch/nn/modules/loss.py:512: UserWarning: Using a target size (torch.Size([128])) that is different to the input size (torch.Size([98])) is deprecated. Please ensure they have the same size. return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction) Traceback (most recent call last): File "train_AAE.py", line 324, in <module> main(0, 0) File "train_AAE.py", line 211, in main D_real_loss = BCE_loss(D_result, y_real_) File "/home/jason/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__ result = self.forward(*input, **kwargs) File "/home/jason/.local/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 512, in forward return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction) File "/home/jason/.local/lib/python3.6/site-packages/torch/nn/functional.py", line 2106, in binary_cross_entropy "!= input nelement ({})".format(target.numel(), input.numel())) ValueError: Target and input must have the same number of elements. target nelement (128) != input nelement (98)
How i can fix it?

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