-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Upscale2D or Conv2D produces NaN values #677
Comments
Is this with Edit: nvm i see it happens with both |
Do you happen to have the image sizes that upscale is scaling to? I'm wondering if float h_scale = ((float)op.h_in-1)/(op.h_out-1);
float w_scale = ((float)op.w_in-1)/(op.w_out-1); is producing nans, but that would require h_out/w_out to be Edit: but I guess that would result in ALL the values in the image being Nan, not just the edge |
I suspect that this bug is memory-related, and it being difficult to reproduce is due to the pseudo-randomness in cuda's malloc algorithm. |
Also, this happens in the forward call right? Not backward? |
Yes, at least within my application, it happens in the forward call. If it had happened in the backward call, parameters would have been set to NaN and caused the entire output to be NaN. |
The weird thing is since upscale2d calls |
Yes, and it seems impossible for upscale2d to read out of bounds as long as the data in |
Oh I figured it out - there's a bug in the upscale2d kernel. Will push to the above PR |
My application using dfdx: https://github.com/nkoppel/generals-bot is currently failing to train a unet to play generals.io because the policy network produces NaN values during training. This is probably a bug in Conv2D or Upscale2D, as the NaN values only occupy a small area of the output, and this program has successfully trained networks without Upscale2D. The NaN values occur about every 100-500 batches, and appear only in the last image of a batch, in the following shape:
(along the bottom and the bottom 3 of the right edge, for all 4 output channels)
Due to its relative rarity and the consistency of the shape of the NaN values, I suspect that this is a bug due to Conv2D or Upscale2D reading uninitialized memory or failing to write to uninitialized memory, but I have been unable to locate the bug thus far. It is probably more likely to be a bug in Upscale2D, because I have tried using the new cudnn implementation of Conv2D, and experienced the exact same behavior.
This error is reproduced here: https://gist.github.com/nkoppel/db07f684222a7169d2c39b205542d4c5. I have no idea why, but using Sgd or inspecting the value of
out
both prevent the bug from occurring.The text was updated successfully, but these errors were encountered: