-
Notifications
You must be signed in to change notification settings - Fork 3.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
Fixing jit.trace
tracing a constant number of nodes with add_self_loops
#7330
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #7330 +/- ##
=======================================
Coverage 91.53% 91.53%
=======================================
Files 438 438
Lines 24361 24364 +3
=======================================
+ Hits 22298 22301 +3
Misses 2063 2063
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
jit.trace
tracing a constant number of nodes with add_self_loops
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.
Thank you! I somehow missed the issue, so thanks for fixing it :) Cool solution.
Fix of issue #7226.
The problem I described came from the
maybe_num_nodes
function which computedint(edge_index.max()) + 1
. Theint()
call made the computed number of nodes a constant for thetorch.jit.trace
function.I fixed it with an if branch that is only executed while tracing. (I could not get the same code for all cases to work: the workaround used only for tracing now would also work for normal operation, but then would break when using
torch.jit.script
).