-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fixed bug in utils.bipartite_subgraph
#6654
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…HeteroData.subgraph
Codecov Report
@@ Coverage Diff @@
## master #6654 +/- ##
=======================================
Coverage 88.97% 88.97%
=======================================
Files 423 423
Lines 22957 22958 +1
=======================================
+ Hits 20425 20427 +2
+ Misses 2532 2531 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
utils.bipartite_subgraph
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing.
The PR fixes a bug in the
utils.bipartite_subgraph
method, which crashes ifsrc_subset
contains Boolean values butdst_subset
contains integers.Consider the following example:
With torch_geometric==2.3.0 we obtain the following error:
The method determines whether or not a cast of the masks is needed by only checking the dtype of the source mask, which causes this issue.
While this seems like a rare edge case, this issue does cause the
HeteroData.subgraph
method to crash whensubset_dict
uses Boolean masks and does not contain some ntypes as keys, as integer tensors are then added for the missing ntypes.Since #6218,
HeteroData.subgraph
does retain ntypes that are absent fromsubset_dict
. I have also updated the doc string of the method to reflect this change, since it was still describing the previous behavior.