Drop torch.jit.script from SelectOutput and ConnectOutput#10701
Open
V-3604 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10697.
torch.jit.scriptis deprecated in PyTorch 2.12 and emits aDeprecationWarningwhether its called as a function or used as a decorator. The module level calls:in
select/base.pyandconnect/base.pytherefore raise the warning at import time, whichpyproject.toml''serror:.*torch_geometric.*filter treats as a test error. There is a workaround in place (ignore:.*torch.jit.*further down in the filter list) but the deprecated call itself is still there.This drops the scripting on both classes. They are now plain Python classes with type annotations and a custom
__init__.@dataclass(init=False)is removed because it isn''t needed once we are not scripting the result (and the synthesized__repr__actually trips up TorchScript when downstream modules that return these types are scripted).Verified on
torch==2.12.0:-W error::DeprecationWarningpasses)test/nn/pool/select/test_select_topk.pyandtest/nn/pool/connect/test_filter_edges.pyboth pass (theis_full_test()JIT branches are not exercised by default, but I separately confirmedtorch.jit.script(FilterEdges())still scripts correctly with the refactoredConnectOutput)test/nn/pool/suite: 28 passed, 16 skipped (unrelated optional deps)The
ignore:.*torch.jit.*:DeprecationWarningfilter inpyproject.tomlis left in place since the remainingtorch.jit.script(module)calls in theis_full_test()paths still emit the same warning.Screenshot:
