-
Notifications
You must be signed in to change notification settings - Fork 24.3k
torch.bincount errors on empty input #9756
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
Comments
@davidbau Numpy doesn't document this behavior docs here for the The docs suggest the output should be
but if |
Producing an empty vector from an empty count makes sense to me, although I find that in practice, I'm always using minlength, in which case the right output shape is unambiguous. |
Summary: Added tests too. Fixes pytorch#9756 . Pull Request resolved: pytorch#9757 Differential Revision: D8966879 Pulled By: soumith fbshipit-source-id: 9f08a9d5d5d037db16319141d7a227a5efa23869
Summary: Added tests too. Fixes pytorch#9756 . Pull Request resolved: pytorch#9757 Differential Revision: D8966879 Pulled By: soumith fbshipit-source-id: 9f08a9d5d5d037db16319141d7a227a5efa23869
Uh oh!
There was an error while loading. Please reload this page.
Issue description
torch.bincount
gives an error when given an empty tensor, rather than just returning zero counts likenumpy.bincount
. Trips up edge cases when counting filtered data.Code example
The text was updated successfully, but these errors were encountered: