-
Notifications
You must be signed in to change notification settings - Fork 181
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
Non contiguous arrays? #93
Comments
Thanks for making an issue! Does this still happen with the latest version of the library? We became aware of this issue (it actually only happens with PyTorch 1.7) a few months ago and so we changed that line to use .reshape() instead: robustness/robustness/tools/helpers.py Line 75 in 79d371f
The updated version should be available on PyPI; let us know if the problem persists after a |
Great thanks, updating to the newest version fixed it! Don't know if you want to change the robustness version in the requirements.txt file for the other project. |
Hi, I found a problem reproducing the basic example in https://github.com/microsoft/robust-models-transfer (I downloaded
resnet18_l2_eps3.ckpt
).Problem is that I get NaN values for accuracy. If I print the exception caught at Line 470 of
robustness/train.py
it says the followingUserWarning: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
I investigated a bit and I can fix this by adding
.contiguous()
in the accuracy computation inrobustness/tools/helpers.py
:correct_k = correct[:k].contiguous().view(-1).float()
, I found a similar issue here cezannec/capsule_net_pytorch#4. The problem was when computing top-5 accuracy specifically (I assume it would happen with everything higher than top-1). Changing that line made everything work again.I haven't opened a pull request because I'm not sure why this happens in my setup, I am running everything inside this docker container and on an Nvidia Titan RTX.
The text was updated successfully, but these errors were encountered: