-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
CUDA assertion error binary_cross_entropy loss #9
Comments
@blancaag I have met the same problem? How did you fix it? |
@mangdian I mention it above. Get's fixed applying nn.BCEWithLogitsLoss() instead of nn.BCELoss() in networks.py line 82 --it restricts loss values between 0 and 1 before applying the loss. |
I think I'm having the same issue but only when I use my own dataset. I've tried nn.BCEWithLogitsLoss() but with no luck. It must be related to my data but I can't figure out what I must be missing.
|
@aviel08 - I think it's a different error and not in the BCELoss - "AssertionindexValue >= 0 && indexValue < tensor.sizes[dim]". I'd suggest to start printing the shape of the input tensors after this line: https://github.com/NVIDIA/pix2pixHD/blob/20687df85d30e6fff5aafb29b7981923da9fd02f/train.py#L51
… On 15 Aug 2018, at 08:37, Alex Leiva ***@***.***> wrote:
ndexValue < tensor.sizes[dim]failed. /opt/conda/conda-
|
@aviel08 I met the same problem,how did you solve it |
You can use torch.clamp(0,1) after your sigmoid layer |
I had to also add:
|
I have applyed nn.BCEWithLogitsLoss() instead of BECLoss(),solve it |
I find that @relh's solution is effective.
|
A CUDA assertion error pops up when setting --no_lsgan. It seems it's because there are negative values thrown into the nn.BCELoss(). Get's fixed applying nn.BCEWithLogitsLoss() instead.
The text was updated successfully, but these errors were encountered: