-
Notifications
You must be signed in to change notification settings - Fork 7k
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 zero depreciated fix #2314
non zero depreciated fix #2314
Conversation
Hi, Thanks for the PR! There are a few issues with torchvision CI, let me try to fix it and then get back to you, some of the errors are unrelated to your PR |
Yes, absolutely I was a little concerned it might be a code bug. Well, thanks for the clarification! |
Hum, looks like torchscript and ONNX might not support the I think a potentially better fix is to replace
cc @eellison and @neginraoof FYI about torchscript and ONNX apparent limitations on |
So, according to @gchanan, the difference between This means that merging this PR is currently blocked by torchscript and ONNX changes. |
@eellison just proposed to use |
Yes, completely agree with @gchanan |
@java-abhinav07 if ONNX tests pass with the change, then it |
Great, I'll commit new changes by tomorrow! I found this open issue though pytorch/pytorch#27959 |
local sync
…o abhinav/non_zero_bug
#1916 Facing this issue locally as well (travis-ci check doesn't pass because of this), could you give some insight into why this is happening @fmassa , possibly version mismatch (I'm using a cpu device)?
|
@java-abhinav07 looks like ONNX doesn't support Also, @java-abhinav07 why did you use |
@fmassa no solely using
|
@java-abhinav07 most usages of In [2]: a = torch.rand(10)
In [3]: a
Out[3]:
tensor([0.4069, 0.6907, 0.0880, 0.4860, 0.0721, 0.3742, 0.2973, 0.7450, 0.3434,
0.9473])
In [4]: (a > 0.5).nonzero()
Out[4]:
tensor([[1],
[7],
[9]])
In [5]: (a > 0.5).nonzero().squeeze(1)
Out[5]: tensor([1, 7, 9])
In [6]: torch.where(a > 0.5)[0]
Out[6]: tensor([1, 7, 9]) |
@fmassa I see, yes if we are using a 1D tensor for subsequent nonzero computations then there is no need for |
@java-abhinav07 sorry for the delay in replying. Most places are sure to have a 1d tensor all the time, I think there is only one occurence that this is not the case I think. But given that ONNX doesn't support this overload yet, we can't merge this PR for now unfortunately |
As you mentioned, ONNX export is missing for Export of where op is possible using a combination of NonZero and Unbind ops. We need to fix both issues to be able to fix Faster_RCNN tests with there updates. |
We can wait for ONNX support to be fixed, or open another PR later (@fmassa feel free to close the pr accordingly). @neginraoof if opening an onnx export issue helps we could create one. Either way, yeah, it makes sense, understood! |
I'm going to send out a PR for export of where op and necessary export fixes. |
PR to address export issue: pytorch/pytorch#41544 |
local sync
Subsumed by #2705. Thanks for all the work @java-abhinav07 ! |
To fix non zero deprecation warning. Decreases time of execution of frcnn, keypoint_rcnn etc models significantly on account of the time taken by warning.
Fixing #2154