Skip to content
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

Fix usage of nonzero for PyTorch 1.7+ #79

Closed
mberr opened this issue Aug 25, 2020 · 0 comments · Fixed by #86
Closed

Fix usage of nonzero for PyTorch 1.7+ #79

mberr opened this issue Aug 25, 2020 · 0 comments · Fixed by #86
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mberr
Copy link
Member

mberr commented Aug 25, 2020

Is your feature request related to a problem? Please describe.
The usage of Tensor.nonzero() (without arguments) has been deprecated, cf. pytorch/pytorch#40187

At least in

filter_batch = (entity_filter_test & relation_filter).nonzero()

we use the now deprecated version.

Describe the solution you'd like
Change all usages of nonzero to use to future-proof variant, i.e. in the above mentioned case

filter_batch = (entity_filter_test & relation_filter).nonzero(as_tuple=False) 

Describe alternatives you've considered
Keep it as it is. This might lead to problems once PyTorch removes the deprecated behaviour.

Additional context
Warning found in this notebook: https://gist.github.com/cthoyt/190233fd98a11306ceb13f2ee0e95a9e (scroll all the way to the bottom)

@mberr mberr added enhancement New feature or request good first issue Good for newcomers labels Aug 25, 2020
@cthoyt cthoyt closed this as completed in #86 Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant